summaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com/yahoo/searchdefinition/FeatureNamesTestCase.java
diff options
context:
space:
mode:
Diffstat (limited to 'config-model/src/test/java/com/yahoo/searchdefinition/FeatureNamesTestCase.java')
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/FeatureNamesTestCase.java20
1 files changed, 14 insertions, 6 deletions
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/FeatureNamesTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/FeatureNamesTestCase.java
index aa01070d296..1f60ad870ec 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/FeatureNamesTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/FeatureNamesTestCase.java
@@ -18,6 +18,17 @@ import static org.junit.Assert.assertFalse;
public class FeatureNamesTestCase {
@Test
+ public void testCanonicalization() {
+ assertFalse(FeatureNames.canonicalizeIfValid("foo").isPresent());
+ assertEquals("query(bar)", FeatureNames.canonicalize("query(bar)"));
+ assertEquals("query(bar)", FeatureNames.canonicalize("query('bar')"));
+ assertEquals("constant(bar)", FeatureNames.canonicalize("constant(\"bar\")"));
+ assertEquals("query(\"ba.r\")", FeatureNames.canonicalize("query(ba.r)"));
+ assertEquals("query(\"ba.r\")", FeatureNames.canonicalize("query('ba.r')"));
+ assertEquals("attribute(\"ba.r\")", FeatureNames.canonicalize("attribute(\"ba.r\")"));
+ }
+
+ @Test
public void testArgument() {
assertFalse(FeatureNames.argumentOf("foo(bar)").isPresent());
assertFalse(FeatureNames.argumentOf("foo(bar.baz)").isPresent());
@@ -31,20 +42,17 @@ public class FeatureNamesTestCase {
@Test
public void testConstantFeature() {
- assertEquals("constant(\"foo/bar\")",
- FeatureNames.asConstantFeature("foo/bar").toString());
+ assertEquals("constant(\"foo/bar\")", FeatureNames.asConstantFeature("foo/bar"));
}
@Test
public void testAttributeFeature() {
- assertEquals("attribute(foo)",
- FeatureNames.asAttributeFeature("foo").toString());
+ assertEquals("attribute(foo)", FeatureNames.asAttributeFeature("foo"));
}
@Test
public void testQueryFeature() {
- assertEquals("query(\"foo.bar\")",
- FeatureNames.asQueryFeature("foo.bar").toString());
+ assertEquals("query(\"foo.bar\")", FeatureNames.asQueryFeature("foo.bar"));
}
}