diff options
author | Jon Bratseth <bratseth@verizonmedia.com> | 2019-04-09 13:44:59 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@verizonmedia.com> | 2019-04-09 13:44:59 +0200 |
commit | d623049d2ba3b12c90a1592580e4b4f238f14731 (patch) | |
tree | 32db702508cf315d010eb92c695dda8fffcb9a0c /container-search/src/test/java/com/yahoo/search/query/QueryTreeTest.java | |
parent | b8f02d9ef033d418764d1af6ebfd773fb2673086 (diff) |
Make QueryTree.and public
- Make QueryTree.and public as it handles more cases than most alternatives
- Implement QueryTreeUtils methodas by calling QueryTree.and
- Deprecate QueryTreeUtils
Diffstat (limited to 'container-search/src/test/java/com/yahoo/search/query/QueryTreeTest.java')
-rw-r--r-- | container-search/src/test/java/com/yahoo/search/query/QueryTreeTest.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/container-search/src/test/java/com/yahoo/search/query/QueryTreeTest.java b/container-search/src/test/java/com/yahoo/search/query/QueryTreeTest.java new file mode 100644 index 00000000000..f929e54fd2d --- /dev/null +++ b/container-search/src/test/java/com/yahoo/search/query/QueryTreeTest.java @@ -0,0 +1,26 @@ +// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.search.query; + +import com.yahoo.prelude.query.NotItem; +import com.yahoo.prelude.query.WordItem; +import org.junit.Assert; +import org.junit.Test; +import static org.junit.Assert.assertEquals; + +/** + * @author bratseth + */ +public class QueryTreeTest { + + @Test + public void testAddQueryItemWithRoot() { + Assert.assertEquals("AND a b", + new QueryTree(new WordItem("a")).and(new WordItem("b")).toString()); + + NotItem not = new NotItem(); + not.addNegativeItem(new WordItem("b")); + assertEquals("+a -b", + new QueryTree(new WordItem("a")).and(not).toString()); + } + +} |