diff options
Diffstat (limited to 'jdisc_core/src/test/java/com/yahoo/jdisc/application')
7 files changed, 62 insertions, 66 deletions
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/application/BindingSetTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/application/BindingSetTestCase.java index e35f1c69073..133472f5678 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/application/BindingSetTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/application/BindingSetTestCase.java @@ -8,7 +8,6 @@ import org.junit.jupiter.api.Test; import java.net.URI; import java.util.ArrayList; -import java.util.Arrays; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; @@ -480,13 +479,13 @@ public class BindingSetTestCase { for (int i = 0; i < expected.length; ++i) { actual.add(expected[(off + i) % expected.length]); } - assertOrder(Arrays.asList(expected), actual); + assertOrder(List.of(expected), actual); actual = new ArrayList<>(); for (int i = expected.length; --i >= 0; ) { actual.add(expected[(off + i) % expected.length]); } - assertOrder(Arrays.asList(expected), actual); + assertOrder(List.of(expected), actual); } } diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/application/BundleInstallationExceptionTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/application/BundleInstallationExceptionTestCase.java index 6a704b1aacc..34ac6603e62 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/application/BundleInstallationExceptionTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/application/BundleInstallationExceptionTestCase.java @@ -5,9 +5,9 @@ import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.osgi.framework.Bundle; -import java.util.Arrays; import java.util.Collection; import java.util.LinkedList; +import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertSame; @@ -41,7 +41,7 @@ public class BundleInstallationExceptionTestCase { @Test void requireThatBundlesCollectionIsUnmodifiable() { - BundleInstallationException e = new BundleInstallationException(Arrays.asList(Mockito.mock(Bundle.class)), + BundleInstallationException e = new BundleInstallationException(List.of(Mockito.mock(Bundle.class)), new Throwable()); try { e.installedBundles().add(Mockito.mock(Bundle.class)); diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/application/ContainerBuilderTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/application/ContainerBuilderTestCase.java index 9b3d61d7c89..3737647679d 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/application/ContainerBuilderTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/application/ContainerBuilderTestCase.java @@ -8,7 +8,7 @@ import com.yahoo.jdisc.test.TestDriver; import org.junit.jupiter.api.Test; import java.net.URISyntaxException; -import java.util.Arrays; +import java.util.List; import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; @@ -106,11 +106,11 @@ public class ContainerBuilderTestCase { assertTrue(ContainerBuilder.safeStringSplit(new Object(), ",").isEmpty()); assertTrue(ContainerBuilder.safeStringSplit("", ",").isEmpty()); assertTrue(ContainerBuilder.safeStringSplit(" \f\n\r\t", ",").isEmpty()); - assertEquals(Arrays.asList("foo"), ContainerBuilder.safeStringSplit("foo", ",")); - assertEquals(Arrays.asList("foo"), ContainerBuilder.safeStringSplit(" foo", ",")); - assertEquals(Arrays.asList("foo"), ContainerBuilder.safeStringSplit("foo ", ",")); - assertEquals(Arrays.asList("foo"), ContainerBuilder.safeStringSplit("foo, ", ",")); - assertEquals(Arrays.asList("foo"), ContainerBuilder.safeStringSplit("foo ,", ",")); - assertEquals(Arrays.asList("foo", "bar"), ContainerBuilder.safeStringSplit("foo, bar", ",")); + assertEquals(List.of("foo"), ContainerBuilder.safeStringSplit("foo", ",")); + assertEquals(List.of("foo"), ContainerBuilder.safeStringSplit(" foo", ",")); + assertEquals(List.of("foo"), ContainerBuilder.safeStringSplit("foo ", ",")); + assertEquals(List.of("foo"), ContainerBuilder.safeStringSplit("foo, ", ",")); + assertEquals(List.of("foo"), ContainerBuilder.safeStringSplit("foo ,", ",")); + assertEquals(List.of("foo", "bar"), ContainerBuilder.safeStringSplit("foo, bar", ",")); } } diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/application/GlobPatternTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/application/GlobPatternTestCase.java index ef09c854f72..0e5df5656c4 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/application/GlobPatternTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/application/GlobPatternTestCase.java @@ -4,7 +4,6 @@ package com.yahoo.jdisc.application; import org.junit.jupiter.api.Test; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -42,14 +41,14 @@ public class GlobPatternTestCase { assertMatch("foo", "foo", Collections.<String>emptyList()); assertNotMatch("foo", "bar"); - assertMatch("*", "foo", Arrays.asList("foo")); - assertMatch("*", "bar", Arrays.asList("bar")); + assertMatch("*", "foo", List.of("foo")); + assertMatch("*", "bar", List.of("bar")); - assertMatch("*foo", "foo", Arrays.asList("")); - assertMatch("*oo", "foo", Arrays.asList("f")); - assertMatch("f*o", "foo", Arrays.asList("o")); - assertMatch("fo*", "foo", Arrays.asList("o")); - assertMatch("foo*", "foo", Arrays.asList("")); + assertMatch("*foo", "foo", List.of("")); + assertMatch("*oo", "foo", List.of("f")); + assertMatch("f*o", "foo", List.of("o")); + assertMatch("fo*", "foo", List.of("o")); + assertMatch("foo*", "foo", List.of("")); assertNotMatch("*foo", "bar"); assertNotMatch("*oo", "bar"); @@ -57,11 +56,11 @@ public class GlobPatternTestCase { assertNotMatch("fo*", "bar"); assertNotMatch("foo*", "bar"); - assertMatch("**foo", "foo", Arrays.asList("", "")); - assertMatch("**oo", "foo", Arrays.asList("", "f")); - assertMatch("f**o", "foo", Arrays.asList("", "o")); - assertMatch("fo**", "foo", Arrays.asList("", "o")); - assertMatch("foo**", "foo", Arrays.asList("", "")); + assertMatch("**foo", "foo", List.of("", "")); + assertMatch("**oo", "foo", List.of("", "f")); + assertMatch("f**o", "foo", List.of("", "o")); + assertMatch("fo**", "foo", List.of("", "o")); + assertMatch("foo**", "foo", List.of("", "")); assertNotMatch("**foo", "bar"); assertNotMatch("**oo", "bar"); @@ -70,9 +69,9 @@ public class GlobPatternTestCase { assertNotMatch("foo**", "bar"); assertMatch("foo bar", "foo bar", Collections.<String>emptyList()); - assertMatch("*foo *bar", "foo bar", Arrays.asList("", "")); - assertMatch("foo* bar*", "foo bar", Arrays.asList("", "")); - assertMatch("f* *r", "foo bar", Arrays.asList("oo", "ba")); + assertMatch("*foo *bar", "foo bar", List.of("", "")); + assertMatch("foo* bar*", "foo bar", List.of("", "")); + assertMatch("f* *r", "foo bar", List.of("oo", "ba")); assertNotMatch("foo bar", "baz cox"); assertNotMatch("*foo *bar", "baz cox"); diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/application/GuiceRepositoryTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/application/GuiceRepositoryTestCase.java index 7aa8a16d856..30c917f9150 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/application/GuiceRepositoryTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/application/GuiceRepositoryTestCase.java @@ -12,7 +12,6 @@ import com.google.inject.name.Named; import com.google.inject.name.Names; import org.junit.jupiter.api.Test; -import java.util.Arrays; import java.util.Iterator; import java.util.List; @@ -47,7 +46,7 @@ public class GuiceRepositoryTestCase { GuiceRepository guice = new GuiceRepository(); StringBinding foo = new StringBinding("fooKey", "fooVal"); StringBinding bar = new StringBinding("barKey", "barVal"); - guice.installAll(Arrays.asList(foo, bar)); + guice.installAll(List.of(foo, bar)); assertBinding(guice, "fooKey", "fooVal"); assertBinding(guice, "barKey", "barVal"); @@ -77,12 +76,12 @@ public class GuiceRepositoryTestCase { StringBinding foo = new StringBinding("fooKey", "fooVal"); StringBinding bar = new StringBinding("barKey", "barVal"); StringBinding baz = new StringBinding("bazKey", "bazVal"); - guice.installAll(Arrays.asList(foo, bar, baz)); + guice.installAll(List.of(foo, bar, baz)); assertBinding(guice, "fooKey", "fooVal"); assertBinding(guice, "barKey", "barVal"); assertBinding(guice, "bazKey", "bazVal"); - guice.uninstallAll(Arrays.asList(foo, baz)); + guice.uninstallAll(List.of(foo, baz)); assertNoBinding(guice, "fooKey"); assertBinding(guice, "barKey", "barVal"); assertNoBinding(guice, "bazKey"); @@ -122,7 +121,7 @@ public class GuiceRepositoryTestCase { void requireThatPrivateModulesWorks() { GuiceRepository guice = new GuiceRepository(); - List<Named> names = Arrays.asList(Names.named("A"), Names.named("B")); + List<Named> names = List.of(Names.named("A"), Names.named("B")); for (Named name : names) { guice.install(createPrivateInjectNameModule(name)); diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/application/ServerRepositoryTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/application/ServerRepositoryTestCase.java index 3a2db7d1e75..a54a42228e4 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/application/ServerRepositoryTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/application/ServerRepositoryTestCase.java @@ -5,8 +5,8 @@ import com.yahoo.jdisc.NoopSharedResource; import com.yahoo.jdisc.service.ServerProvider; import org.junit.jupiter.api.Test; -import java.util.Arrays; import java.util.Iterator; +import java.util.List; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -35,7 +35,7 @@ public class ServerRepositoryTestCase { ServerRepository servers = newServerRepository(); ServerProvider foo = new MyServer(); ServerProvider bar = new MyServer(); - servers.installAll(Arrays.asList(foo, bar)); + servers.installAll(List.of(foo, bar)); Iterator<ServerProvider> it = servers.iterator(); assertTrue(it.hasNext()); @@ -60,8 +60,8 @@ public class ServerRepositoryTestCase { ServerProvider foo = new MyServer(); ServerProvider bar = new MyServer(); ServerProvider baz = new MyServer(); - servers.installAll(Arrays.asList(foo, bar, baz)); - servers.uninstallAll(Arrays.asList(foo, bar)); + servers.installAll(List.of(foo, bar, baz)); + servers.uninstallAll(List.of(foo, bar)); Iterator<ServerProvider> it = servers.iterator(); assertNotNull(it); assertTrue(it.hasNext()); diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/application/UriPatternTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/application/UriPatternTestCase.java index 063ddc81f45..0f8016eba10 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/application/UriPatternTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/application/UriPatternTestCase.java @@ -5,7 +5,6 @@ import org.junit.jupiter.api.Test; import java.net.URI; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -49,19 +48,19 @@ public class UriPatternTestCase { assertNotMatch(pattern, "barbaz://host:69/path"); pattern = new UriPattern("*://host:69/path"); - assertMatch(pattern, "foobar://host:69/path", Arrays.asList("foobar")); - assertMatch(pattern, "bar://host:69/path", Arrays.asList("bar")); - assertMatch(pattern, "barbaz://host:69/path", Arrays.asList("barbaz")); + assertMatch(pattern, "foobar://host:69/path", List.of("foobar")); + assertMatch(pattern, "bar://host:69/path", List.of("bar")); + assertMatch(pattern, "barbaz://host:69/path", List.of("barbaz")); pattern = new UriPattern("*bar://host:69/path"); - assertMatch(pattern, "foobar://host:69/path", Arrays.asList("foo")); - assertMatch(pattern, "bar://host:69/path", Arrays.asList("")); + assertMatch(pattern, "foobar://host:69/path", List.of("foo")); + assertMatch(pattern, "bar://host:69/path", List.of("")); assertNotMatch(pattern, "barbaz://host:69/path"); pattern = new UriPattern("bar*://host:69/path"); assertNotMatch(pattern, "foobar://host:69/path"); - assertMatch(pattern, "bar://host:69/path", Arrays.asList("")); - assertMatch(pattern, "barbaz://host:69/path", Arrays.asList("baz")); + assertMatch(pattern, "bar://host:69/path", List.of("")); + assertMatch(pattern, "barbaz://host:69/path", List.of("baz")); // host matching pattern = new UriPattern("scheme://bar:69/path"); @@ -70,19 +69,19 @@ public class UriPatternTestCase { assertNotMatch(pattern, "scheme://barbaz:69/path"); pattern = new UriPattern("scheme://*:69/path"); - assertMatch(pattern, "scheme://foobar:69/path", Arrays.asList("foobar")); - assertMatch(pattern, "scheme://bar:69/path", Arrays.asList("bar")); - assertMatch(pattern, "scheme://barbaz:69/path", Arrays.asList("barbaz")); + assertMatch(pattern, "scheme://foobar:69/path", List.of("foobar")); + assertMatch(pattern, "scheme://bar:69/path", List.of("bar")); + assertMatch(pattern, "scheme://barbaz:69/path", List.of("barbaz")); pattern = new UriPattern("scheme://*bar:69/path"); - assertMatch(pattern, "scheme://foobar:69/path", Arrays.asList("foo")); - assertMatch(pattern, "scheme://bar:69/path", Arrays.asList("")); + assertMatch(pattern, "scheme://foobar:69/path", List.of("foo")); + assertMatch(pattern, "scheme://bar:69/path", List.of("")); assertNotMatch(pattern, "scheme://barbaz:69/path"); pattern = new UriPattern("scheme://bar*:69/path"); assertNotMatch(pattern, "scheme://foobar:69/path"); - assertMatch(pattern, "scheme://bar:69/path", Arrays.asList("")); - assertMatch(pattern, "scheme://barbaz:69/path", Arrays.asList("baz")); + assertMatch(pattern, "scheme://bar:69/path", List.of("")); + assertMatch(pattern, "scheme://barbaz:69/path", List.of("baz")); // port matching pattern = new UriPattern("scheme://host:69/path"); @@ -91,9 +90,9 @@ public class UriPatternTestCase { assertNotMatch(pattern, "scheme://host:699/path"); pattern = new UriPattern("scheme://host:*/path"); - assertMatch(pattern, "scheme://host:669/path", Arrays.asList("669")); - assertMatch(pattern, "scheme://host:69/path", Arrays.asList("69")); - assertMatch(pattern, "scheme://host:699/path", Arrays.asList("699")); + assertMatch(pattern, "scheme://host:669/path", List.of("669")); + assertMatch(pattern, "scheme://host:69/path", List.of("69")); + assertMatch(pattern, "scheme://host:699/path", List.of("699")); // path matching pattern = new UriPattern("scheme://host:69/"); @@ -106,20 +105,20 @@ public class UriPatternTestCase { assertNotMatch(pattern, "scheme://host:69/barbaz"); pattern = new UriPattern("scheme://host:69/*"); - assertMatch(pattern, "scheme://host:69/", Arrays.asList("")); - assertMatch(pattern, "scheme://host:69/foobar", Arrays.asList("foobar")); - assertMatch(pattern, "scheme://host:69/bar", Arrays.asList("bar")); - assertMatch(pattern, "scheme://host:69/barbaz", Arrays.asList("barbaz")); + assertMatch(pattern, "scheme://host:69/", List.of("")); + assertMatch(pattern, "scheme://host:69/foobar", List.of("foobar")); + assertMatch(pattern, "scheme://host:69/bar", List.of("bar")); + assertMatch(pattern, "scheme://host:69/barbaz", List.of("barbaz")); pattern = new UriPattern("scheme://host:69/*bar"); - assertMatch(pattern, "scheme://host:69/foobar", Arrays.asList("foo")); - assertMatch(pattern, "scheme://host:69/bar", Arrays.asList("")); + assertMatch(pattern, "scheme://host:69/foobar", List.of("foo")); + assertMatch(pattern, "scheme://host:69/bar", List.of("")); assertNotMatch(pattern, "scheme://host:69/barbaz"); pattern = new UriPattern("scheme://host:69/bar*"); assertNotMatch(pattern, "scheme://host:69/foobar"); - assertMatch(pattern, "scheme://host:69/bar", Arrays.asList("")); - assertMatch(pattern, "scheme://host:69/barbaz", Arrays.asList("baz")); + assertMatch(pattern, "scheme://host:69/bar", List.of("")); + assertMatch(pattern, "scheme://host:69/barbaz", List.of("baz")); } @Test @@ -128,7 +127,7 @@ public class UriPatternTestCase { assertNotMatch(pattern, "scheme://host"); pattern = new UriPattern("scheme://host/*"); - assertMatch(pattern, "scheme://host", Arrays.asList("")); + assertMatch(pattern, "scheme://host", List.of("")); } @Test @@ -141,8 +140,8 @@ public class UriPatternTestCase { @Test void requireThatHostSupportsWildcard() { UriPattern pattern = new UriPattern("scheme://*.host/path"); - assertMatch(pattern, "scheme://a.host/path", Arrays.asList("a")); - assertMatch(pattern, "scheme://a.b.host/path", Arrays.asList("a.b")); + assertMatch(pattern, "scheme://a.host/path", List.of("a")); + assertMatch(pattern, "scheme://a.b.host/path", List.of("a.b")); } @Test |