diff options
Diffstat (limited to 'container-search/src/test/java/com/yahoo/search/query/properties/test')
3 files changed, 37 insertions, 37 deletions
diff --git a/container-search/src/test/java/com/yahoo/search/query/properties/test/PropertyMapTestCase.java b/container-search/src/test/java/com/yahoo/search/query/properties/test/PropertyMapTestCase.java index 5fbe8858186..46859ab1cbe 100644 --- a/container-search/src/test/java/com/yahoo/search/query/properties/test/PropertyMapTestCase.java +++ b/container-search/src/test/java/com/yahoo/search/query/properties/test/PropertyMapTestCase.java @@ -2,13 +2,12 @@ package com.yahoo.search.query.properties.test; import com.yahoo.processing.request.properties.PropertyMap; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Collections; import java.util.List; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.*; /** * @author bratseth @@ -16,24 +15,24 @@ import static org.junit.Assert.assertTrue; public class PropertyMapTestCase { @Test - public void testCloning() { + void testCloning() { PropertyMap map = new PropertyMap(); map.set("clonable", new ClonableObject()); map.set("nonclonable", new NonClonableObject()); - map.set("clonableArray", new ClonableObject[] {new ClonableObject()}); - map.set("nonclonableArray", new NonClonableObject[] {new NonClonableObject()}); + map.set("clonableArray", new ClonableObject[]{new ClonableObject()}); + map.set("nonclonableArray", new NonClonableObject[]{new NonClonableObject()}); map.set("clonableList", Collections.singletonList(new ClonableObject())); map.set("nonclonableList", Collections.singletonList(new NonClonableObject())); assertNotNull(map.get("clonable")); assertNotNull(map.get("nonclonable")); - PropertyMap mapClone=map.clone(); + PropertyMap mapClone = map.clone(); assertTrue(map.get("clonable") != mapClone.get("clonable")); - assertTrue(map.get("nonclonable") == mapClone.get("nonclonable")); + assertEquals(map.get("nonclonable"), mapClone.get("nonclonable")); assertTrue(map.get("clonableArray") != mapClone.get("clonableArray")); assertTrue(first(map.get("clonableArray")) != first(mapClone.get("clonableArray"))); - assertTrue(first(map.get("nonclonableArray")) == first(mapClone.get("nonclonableArray"))); + assertEquals(first(map.get("nonclonableArray")), first(mapClone.get("nonclonableArray"))); } private Object first(Object object) { diff --git a/container-search/src/test/java/com/yahoo/search/query/properties/test/RequestContextPropertiesTestCase.java b/container-search/src/test/java/com/yahoo/search/query/properties/test/RequestContextPropertiesTestCase.java index 2a123b4bbda..23b41092660 100644 --- a/container-search/src/test/java/com/yahoo/search/query/properties/test/RequestContextPropertiesTestCase.java +++ b/container-search/src/test/java/com/yahoo/search/query/properties/test/RequestContextPropertiesTestCase.java @@ -5,9 +5,9 @@ import com.yahoo.search.Query; import com.yahoo.search.query.profile.QueryProfile; import com.yahoo.search.query.profile.QueryProfileRegistry; import com.yahoo.search.test.QueryTestCase; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * Tests that dimension arguments in queries are transferred correctly to dimension values @@ -17,18 +17,18 @@ import static org.junit.Assert.assertEquals; public class RequestContextPropertiesTestCase { @Test - public void testIt() { - QueryProfile p=new QueryProfile("test"); - p.setDimensions(new String[] {"x"}); - p.set("a","a-default", (QueryProfileRegistry)null); - p.set("a","a-x1",new String[] {"x1"}, null); - p.set("a","a-+x1",new String[] {"+x1"}, null); + void testIt() { + QueryProfile p = new QueryProfile("test"); + p.setDimensions(new String[]{"x"}); + p.set("a", "a-default", (QueryProfileRegistry) null); + p.set("a", "a-x1", new String[]{"x1"}, null); + p.set("a", "a-+x1", new String[]{"+x1"}, null); Query q1 = new Query(QueryTestCase.httpEncode("?query=foo"), p.compile(null)); - assertEquals("a-default",q1.properties().get("a")); - Query q2 = new Query(QueryTestCase.httpEncode("?query=foo&x=x1"),p.compile(null)); - assertEquals("a-x1",q2.properties().get("a")); - Query q3 = new Query(QueryTestCase.httpEncode("?query=foo&x=+x1"),p.compile(null)); - assertEquals("a-+x1",q3.properties().get("a")); + assertEquals("a-default", q1.properties().get("a")); + Query q2 = new Query(QueryTestCase.httpEncode("?query=foo&x=x1"), p.compile(null)); + assertEquals("a-x1", q2.properties().get("a")); + Query q3 = new Query(QueryTestCase.httpEncode("?query=foo&x=+x1"), p.compile(null)); + assertEquals("a-+x1", q3.properties().get("a")); } } diff --git a/container-search/src/test/java/com/yahoo/search/query/properties/test/SubPropertiesTestCase.java b/container-search/src/test/java/com/yahoo/search/query/properties/test/SubPropertiesTestCase.java index 11c249c5cdb..0e9bf8d41ec 100644 --- a/container-search/src/test/java/com/yahoo/search/query/properties/test/SubPropertiesTestCase.java +++ b/container-search/src/test/java/com/yahoo/search/query/properties/test/SubPropertiesTestCase.java @@ -1,15 +1,14 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.search.query.properties.test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import java.util.Arrays; import java.util.HashSet; import com.yahoo.processing.request.properties.PropertyMap; -import org.junit.Test; - +import org.junit.jupiter.api.Test; import com.yahoo.search.query.properties.SubProperties; /** @@ -18,19 +17,21 @@ import com.yahoo.search.query.properties.SubProperties; public class SubPropertiesTestCase { @Test - public void testSubProperties() { - PropertyMap map = new PropertyMap() {{ - set("a.e","1"); - set("a.f",2); - set("b.e","3"); - set("f",3); - set("e","2"); - set("d","a"); - }}; + void testSubProperties() { + PropertyMap map = new PropertyMap() { + { + set("a.e", "1"); + set("a.f", 2); + set("b.e", "3"); + set("f", 3); + set("e", "2"); + set("d", "a"); + } + }; SubProperties sub = new SubProperties("a", map); - assertEquals("1",sub.get("e")); - assertEquals(2,sub.get("f")); + assertEquals("1", sub.get("e")); + assertEquals(2, sub.get("f")); assertNull(sub.get("d")); assertEquals(new HashSet<>(Arrays.asList("e", "f")), sub.listProperties("").keySet()); } |