aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/prelude/semantics/test/AutomataTestCase.java
diff options
context:
space:
mode:
Diffstat (limited to 'container-search/src/test/java/com/yahoo/prelude/semantics/test/AutomataTestCase.java')
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/semantics/test/AutomataTestCase.java69
1 files changed, 35 insertions, 34 deletions
diff --git a/container-search/src/test/java/com/yahoo/prelude/semantics/test/AutomataTestCase.java b/container-search/src/test/java/com/yahoo/prelude/semantics/test/AutomataTestCase.java
index 71e36e45acc..a9c7202f7cd 100644
--- a/container-search/src/test/java/com/yahoo/prelude/semantics/test/AutomataTestCase.java
+++ b/container-search/src/test/java/com/yahoo/prelude/semantics/test/AutomataTestCase.java
@@ -3,11 +3,11 @@ package com.yahoo.prelude.semantics.test;
import com.yahoo.search.Query;
import com.yahoo.prelude.semantics.RuleBase;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Tests rule bases using automatas for matching
@@ -23,62 +23,63 @@ public class AutomataTestCase extends RuleBaseAbstractTestCase {
}
@Test
- public void testAutomataRuleBase() {
- RuleBase ruleBase=searcher.getDefaultRuleBase();
- assertEquals(RuleBase.class,ruleBase.getClass());
+ void testAutomataRuleBase() {
+ RuleBase ruleBase = searcher.getDefaultRuleBase();
+ assertEquals(RuleBase.class, ruleBase.getClass());
assertTrue(ruleBase.getSource().endsWith(root + "automatarules.sr"));
- assertEquals(root + "semantics.fsa",ruleBase.getAutomataFile());
+ assertEquals(root + "semantics.fsa", ruleBase.getAutomataFile());
- Query query=new Query("?query=sony+digital+camera");
- ruleBase.analyze(query,0);
+ Query query = new Query("?query=sony+digital+camera");
+ ruleBase.analyze(query, 0);
assertEquals("RANK (WEAKAND(100) sony digital camera) dsp1:sony dsp5:digicamera", query.getModel().getQueryTree().getRoot().toString());
- query=new Query("?query=sony+digital+camera&rules.reload");
- ruleBase=searcher.getDefaultRuleBase();
+ query = new Query("?query=sony+digital+camera&rules.reload");
+ ruleBase = searcher.getDefaultRuleBase();
assertTrue(ruleBase.getSource().endsWith(root + "automatarules.sr"));
- assertEquals(root + "semantics.fsa",ruleBase.getAutomataFile());
- ruleBase.analyze(query,0);
+ assertEquals(root + "semantics.fsa", ruleBase.getAutomataFile());
+ ruleBase.analyze(query, 0);
assertEquals("RANK (WEAKAND(100) sony digital camera) dsp1:sony dsp5:digicamera", query.getModel().getQueryTree().getRoot().toString());
}
@Test
- public void testAutomataSingleQuery() {
- assertSemantics("RANK sony dsp1:sony","sony");
+ void testAutomataSingleQuery() {
+ assertSemantics("RANK sony dsp1:sony", "sony");
}
@Test
- public void testAutomataFilterIsIgnored() {
- assertSemantics("RANK sony |something dsp1:sony","sony&filter=something");
- assertSemantics("RANK something |sony","something&filter=sony");
+ void testAutomataFilterIsIgnored() {
+ assertSemantics("RANK sony |something dsp1:sony", "sony&filter=something");
+ assertSemantics("RANK something |sony", "something&filter=sony");
}
@Test
- public void testAutomataPluralMatches() {
- assertSemantics("RANK sonys dsp1:sony","sonys");
+ void testAutomataPluralMatches() {
+ assertSemantics("RANK sonys dsp1:sony", "sonys");
- assertSemantics("RANK (AND car cleaner) dsp1:\"car cleaners\" dsp5:\"car cleaners\"","car cleaner");
+ assertSemantics("RANK (AND car cleaner) dsp1:\"car cleaners\" dsp5:\"car cleaners\"", "car cleaner");
- assertSemantics("RANK (AND sony digitals cameras) dsp1:sony dsp5:digicamera","sony digitals cameras");
+ assertSemantics("RANK (AND sony digitals cameras) dsp1:sony dsp5:digicamera", "sony digitals cameras");
}
@Test
- public void testMatchingMultipleAutomataConditionsSingleWord() {
- assertSemantics("RANK carpenter dsp1:carpenter dsp5:carpenter","carpenter");
+ void testMatchingMultipleAutomataConditionsSingleWord() {
+ assertSemantics("RANK carpenter dsp1:carpenter dsp5:carpenter", "carpenter");
}
@Test
- public void testMatchingMultipleAutomataConditionsPhrase() {
- assertSemantics("RANK (AND car cleaners) dsp1:\"car cleaners\" dsp5:\"car cleaners\"","car cleaners");
+ void testMatchingMultipleAutomataConditionsPhrase() {
+ assertSemantics("RANK (AND car cleaners) dsp1:\"car cleaners\" dsp5:\"car cleaners\"", "car cleaners");
}
+ // TODO: Make this work again
@Test
- @Ignore // TODO: Make this work again
- public void testReplaceOnNoMatch() {
- assertSemantics("nomatch:sonny","sonny&donomatch");
- assertSemantics("RANK sony dsp1:sony","sony&donomatch");
- assertSemantics("RANK sonys dsp1:sony","sonys&donomatch");
- assertSemantics("AND nomatch:sonny nomatch:boy","sonny boy&donomatch");
- assertSemantics("RANK (AND sony nomatch:boy) dsp1:sony","sony boy&donomatch");
+ @Disabled
+ void testReplaceOnNoMatch() {
+ assertSemantics("nomatch:sonny", "sonny&donomatch");
+ assertSemantics("RANK sony dsp1:sony", "sony&donomatch");
+ assertSemantics("RANK sonys dsp1:sony", "sonys&donomatch");
+ assertSemantics("AND nomatch:sonny nomatch:boy", "sonny boy&donomatch");
+ assertSemantics("RANK (AND sony nomatch:boy) dsp1:sony", "sony boy&donomatch");
}
}