diff options
Diffstat (limited to 'jdisc_core/src/test/java/com/yahoo/jdisc/application')
16 files changed, 226 insertions, 226 deletions
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/application/AbstractApplicationTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/application/AbstractApplicationTestCase.java index 3a6aa03ad45..03d5728679f 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/application/AbstractApplicationTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/application/AbstractApplicationTestCase.java @@ -4,15 +4,15 @@ package com.yahoo.jdisc.application; import com.google.inject.Inject; import com.yahoo.jdisc.service.CurrentContainer; import com.yahoo.jdisc.test.TestDriver; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; /** @@ -21,27 +21,27 @@ import static org.junit.Assert.assertTrue; public class AbstractApplicationTestCase { @Test - public void requireThatContainerApiIsAvailable() { + void requireThatContainerApiIsAvailable() { TestDriver driver = TestDriver.newInjectedApplicationInstance(MyApplication.class); - MyApplication app = (MyApplication)driver.application(); + MyApplication app = (MyApplication) driver.application(); app.activateContainer(app.newContainerBuilder()); assertNotNull(app.container()); assertTrue(driver.close()); } @Test - public void requireThatDestroySignalsTermination() { + void requireThatDestroySignalsTermination() { TestDriver driver = TestDriver.newInjectedApplicationInstance(MyApplication.class); - MyApplication app = (MyApplication)driver.application(); + MyApplication app = (MyApplication) driver.application(); assertFalse(app.isTerminated()); assertTrue(driver.close()); assertTrue(app.isTerminated()); } @Test - public void requireThatTerminationCanBeWaitedForWithTimeout() throws InterruptedException { + void requireThatTerminationCanBeWaitedForWithTimeout() throws InterruptedException { TestDriver driver = TestDriver.newInjectedApplicationInstance(MyApplication.class); - final MyApplication app = (MyApplication)driver.application(); + final MyApplication app = (MyApplication) driver.application(); final CountDownLatch latch = new CountDownLatch(1); Executors.newSingleThreadExecutor().execute(new Runnable() { @@ -61,9 +61,9 @@ public class AbstractApplicationTestCase { } @Test - public void requireThatTerminationCanBeWaitedForWithoutTimeout() throws InterruptedException { + void requireThatTerminationCanBeWaitedForWithoutTimeout() throws InterruptedException { TestDriver driver = TestDriver.newInjectedApplicationInstance(MyApplication.class); - final MyApplication app = (MyApplication)driver.application(); + final MyApplication app = (MyApplication) driver.application(); final CountDownLatch latch = new CountDownLatch(1); Executors.newSingleThreadExecutor().execute(new Runnable() { diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/application/ApplicationNotReadyTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/application/ApplicationNotReadyTestCase.java index 63331d2014d..1ac091fcc68 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/application/ApplicationNotReadyTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/application/ApplicationNotReadyTestCase.java @@ -4,11 +4,11 @@ package com.yahoo.jdisc.application; import com.google.inject.Inject; import com.google.inject.ProvisionException; import com.yahoo.jdisc.test.TestDriver; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; /** @@ -17,7 +17,7 @@ import static org.junit.Assert.fail; public class ApplicationNotReadyTestCase { @Test - public void requireThatExceptionIsThrown() { + void requireThatExceptionIsThrown() { try { TestDriver.newInjectedApplicationInstanceWithoutOsgi(MyApplication.class); fail(); diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/application/BindingMatchTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/application/BindingMatchTestCase.java index 5c0942fbf37..7ea8e84228d 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/application/BindingMatchTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/application/BindingMatchTestCase.java @@ -1,13 +1,13 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.jdisc.application; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.net.URI; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.fail; /** @@ -16,7 +16,7 @@ import static org.junit.Assert.fail; public class BindingMatchTestCase { @Test - public void requireThatAccessorsWork() { + void requireThatAccessorsWork() { Object obj = new Object(); UriPattern pattern = new UriPattern("http://*/*"); BindingMatch<Object> match = new BindingMatch<>( @@ -31,7 +31,7 @@ public class BindingMatchTestCase { } @Test - public void requireThatConstructorArgumentsCanNotBeNull() { + void requireThatConstructorArgumentsCanNotBeNull() { try { new BindingMatch<>(null, null, null); fail(); diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/application/BindingRepositoryTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/application/BindingRepositoryTestCase.java index 95ba6cde595..92a85cfdc4a 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/application/BindingRepositoryTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/application/BindingRepositoryTestCase.java @@ -7,19 +7,19 @@ import com.yahoo.jdisc.handler.ContentChannel; import com.yahoo.jdisc.handler.RequestHandler; import com.yahoo.jdisc.handler.ResponseHandler; import com.yahoo.jdisc.test.NonWorkingRequestHandler; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.net.URI; import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; /** * @author Simon Thoresen Hult @@ -27,7 +27,7 @@ import static org.junit.Assert.fail; public class BindingRepositoryTestCase { @Test - public void requireThatRepositoryCanBeActivated() { + void requireThatRepositoryCanBeActivated() { BindingRepository<Object> bindings = new BindingRepository<>(); bindings.bind("http://host/path", new Object()); @@ -41,7 +41,7 @@ public class BindingRepositoryTestCase { } @Test - public void requireThatActivationIsSnapshotOfRepository() { + void requireThatActivationIsSnapshotOfRepository() { BindingRepository<Object> bindings = new BindingRepository<>(); bindings.bind("http://host/path", new Object()); @@ -57,7 +57,7 @@ public class BindingRepositoryTestCase { } @Test - public void requireThatObjectsCanBeBound() { + void requireThatObjectsCanBeBound() { BindingRepository<Object> bindings = new BindingRepository<>(); Object foo = new Object(); Object bar = new Object(); @@ -79,7 +79,7 @@ public class BindingRepositoryTestCase { } @Test - public void requireThatPatternCannotBeStolen() { + void requireThatPatternCannotBeStolen() { final String pattern = "http://host/path"; final RequestHandler originallyBoundHandler = new NonWorkingRequestHandler(); @@ -92,7 +92,7 @@ public class BindingRepositoryTestCase { } @Test - public void requireThatBindAllMethodWorks() { + void requireThatBindAllMethodWorks() { Object foo = new Object(); Object bar = new Object(); Object baz = new Object(); @@ -122,7 +122,7 @@ public class BindingRepositoryTestCase { } @Test - public void requireThatPutAllMethodWorks() { + void requireThatPutAllMethodWorks() { Object foo = new Object(); Object bar = new Object(); Object baz = new Object(); @@ -153,7 +153,7 @@ public class BindingRepositoryTestCase { } @Test - public void requireThatPutNullThrowsException() { + void requireThatPutNullThrowsException() { try { new BindingRepository<>().put(null, new Object()); fail(); 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 3b7d8aafcab..504810dc2ed 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 @@ -4,7 +4,7 @@ package com.yahoo.jdisc.application; import com.yahoo.jdisc.handler.RequestHandler; import com.yahoo.jdisc.test.NonWorkingRequestHandler; import static com.yahoo.vespa.defaults.Defaults.getDefaults; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.net.URI; import java.util.ArrayList; @@ -14,12 +14,12 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; /** @@ -28,7 +28,7 @@ import static org.junit.Assert.assertTrue; public class BindingSetTestCase { @Test - public void requireThatAccessorsWork() { + void requireThatAccessorsWork() { Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>(); RequestHandler foo = new NonWorkingRequestHandler(); handlers.put(new UriPattern("http://host/foo"), foo); @@ -51,7 +51,7 @@ public class BindingSetTestCase { } @Test - public void requireThatSimpleResolutionWorks() { + void requireThatSimpleResolutionWorks() { Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>(); RequestHandler foo = new NonWorkingRequestHandler(); handlers.put(new UriPattern("http://host/foo"), foo); @@ -72,7 +72,7 @@ public class BindingSetTestCase { } @Test - public void requireThatPatternResolutionWorks() { + void requireThatPatternResolutionWorks() { Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>(); RequestHandler foo = new NonWorkingRequestHandler(); handlers.put(new UriPattern("http://host/*"), foo); @@ -94,7 +94,7 @@ public class BindingSetTestCase { } @Test - public void requireThatPatternResolutionWorksForWildCards() { + void requireThatPatternResolutionWorksForWildCards() { Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>(); RequestHandler foo = new NonWorkingRequestHandler(); handlers.put(new UriPattern("http://host:*/bar"), foo); @@ -125,7 +125,7 @@ public class BindingSetTestCase { } @Test - public void requireThatPatternResolutionWorksForFilters() { + void requireThatPatternResolutionWorksForFilters() { Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>(); RequestHandler foo = new NonWorkingRequestHandler(); handlers.put(new UriPattern("http://*/filtered/*"), foo); @@ -139,7 +139,7 @@ public class BindingSetTestCase { } @Test - public void requireThatTreeSplitCanBeBoundForSchemes() { + void requireThatTreeSplitCanBeBoundForSchemes() { Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>(); RequestHandler httpfoo = new NonWorkingRequestHandler(); RequestHandler httpsfoo = new NonWorkingRequestHandler(); @@ -152,7 +152,7 @@ public class BindingSetTestCase { } @Test - public void requireThatTreeSplitCanBeBoundForHosts() { + void requireThatTreeSplitCanBeBoundForHosts() { Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>(); RequestHandler foo = new NonWorkingRequestHandler(); RequestHandler foobar = new NonWorkingRequestHandler(); @@ -165,7 +165,7 @@ public class BindingSetTestCase { } @Test - public void requireThatTreeSplitCanBeBoundForPorts() { + void requireThatTreeSplitCanBeBoundForPorts() { Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>(); RequestHandler foo8080 = new NonWorkingRequestHandler(); RequestHandler foo80 = new NonWorkingRequestHandler(); @@ -181,7 +181,7 @@ public class BindingSetTestCase { } @Test - public void requireThatTreeSplitCanBeBoundForPaths() { + void requireThatTreeSplitCanBeBoundForPaths() { Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>(); RequestHandler foo = new NonWorkingRequestHandler(); RequestHandler foobar = new NonWorkingRequestHandler(); @@ -194,7 +194,7 @@ public class BindingSetTestCase { } @Test - public void requireThatTreeSplitCanBeBoundForWildcards() { + void requireThatTreeSplitCanBeBoundForWildcards() { Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>(); RequestHandler foo8080 = new NonWorkingRequestHandler(); RequestHandler foo80 = new NonWorkingRequestHandler(); @@ -213,7 +213,7 @@ public class BindingSetTestCase { } @Test - public void requireThatTreeWorksForURIWithQueryOrFragments() { + void requireThatTreeWorksForURIWithQueryOrFragments() { Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>(); RequestHandler foo = new NonWorkingRequestHandler(); handlers.put(new UriPattern("http://*/application/v1/session"), foo); @@ -226,7 +226,7 @@ public class BindingSetTestCase { } @Test - public void requireThatTreeWorksForURIWithPathWildCards() { + void requireThatTreeWorksForURIWithPathWildCards() { Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>(); RequestHandler foo = new NonWorkingRequestHandler(); RequestHandler foo1 = new NonWorkingRequestHandler(); @@ -303,7 +303,7 @@ public class BindingSetTestCase { } @Test - public void requireThatPathOverPortWorks() { + void requireThatPathOverPortWorks() { Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>(); RequestHandler applicationStatus = new NonWorkingRequestHandler(); RequestHandler search = new NonWorkingRequestHandler(); @@ -327,7 +327,7 @@ public class BindingSetTestCase { } @Test - public void requireThatPathOverPortsDoNotWorkOverStricterPatterns() { + void requireThatPathOverPortsDoNotWorkOverStricterPatterns() { Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>(); RequestHandler foo = new NonWorkingRequestHandler(); RequestHandler bar = new NonWorkingRequestHandler(); @@ -339,7 +339,7 @@ public class BindingSetTestCase { } @Test - public void requireThatSchemeOrderOverHost() { + void requireThatSchemeOrderOverHost() { Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>(); RequestHandler foo = new NonWorkingRequestHandler(); RequestHandler bar = new NonWorkingRequestHandler(); @@ -352,7 +352,7 @@ public class BindingSetTestCase { } @Test - public void requireThatPortsAreOrdered() { + void requireThatPortsAreOrdered() { Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>(); RequestHandler foo = new NonWorkingRequestHandler(); RequestHandler bar = new NonWorkingRequestHandler(); @@ -370,7 +370,7 @@ public class BindingSetTestCase { } @Test - public void requireThatPathsAreOrdered() { + void requireThatPathsAreOrdered() { Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>(); RequestHandler foo = new NonWorkingRequestHandler(); RequestHandler bar = new NonWorkingRequestHandler(); @@ -388,7 +388,7 @@ public class BindingSetTestCase { } @Test - public void requireThatStrictPatternsOrderBeforeWildcards() { + void requireThatStrictPatternsOrderBeforeWildcards() { Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>(); RequestHandler fooScheme = new NonWorkingRequestHandler(); @@ -436,7 +436,7 @@ public class BindingSetTestCase { } @Test - public void requireThatToStringMethodWorks() { + void requireThatToStringMethodWorks() { Map<UriPattern, RequestHandler> handlers = new LinkedHashMap<>(); RequestHandler foo = new NonWorkingRequestHandler(); RequestHandler bar = new NonWorkingRequestHandler(); @@ -449,7 +449,7 @@ public class BindingSetTestCase { @Test - public void requireThatPatternsAreOrderedMoreSpecificToLess() { + void requireThatPatternsAreOrderedMoreSpecificToLess() { assertOrder("3://host/path", "2://host/path", "1://host/path"); assertOrder("http://3/path", "http://2/path", "http://1/path"); assertOrder("http://host:3/path", "http://host:2/path", "http://host:1/path"); @@ -459,19 +459,19 @@ public class BindingSetTestCase { assertOrder("http://host:*/3", "http://host:2/2", "http://host:1/1"); assertOrder("http://host/*/3/2/", "http://host/*/1/2", "http://host/*/2/*"); assertOrder("http://host:69/path", - "http://host/*", - "http://*:69/path", - "http://*/path", - "http://*:69/*", - "http://*/*", - "*://host/path", - "*://*/path", - "*://*/*"); + "http://host/*", + "http://*:69/path", + "http://*/path", + "http://*:69/*", + "http://*/*", + "*://host/path", + "*://*/path", + "*://*/*"); assertOrder("http://*/HelloWorld", - "http://*:4080/state/v1/*", - "http://*:4083/*", - "http://*:4081/*", - "http://*:4080/*"); + "http://*:4080/state/v1/*", + "http://*:4083/*", + "http://*:4081/*", + "http://*:4080/*"); } private static void assertOrder(String... expected) { 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 681ca4dea98..d16f13814c1 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 @@ -1,7 +1,7 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.jdisc.application; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.osgi.framework.Bundle; @@ -9,9 +9,9 @@ import java.util.Arrays; import java.util.Collection; import java.util.LinkedList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.fail; /** @@ -20,7 +20,7 @@ import static org.junit.Assert.fail; public class BundleInstallationExceptionTestCase { @Test - public void requireThatAccessorsWork() { + void requireThatAccessorsWork() { Throwable t = new Throwable("foo"); Collection<Bundle> bundles = new LinkedList<>(); bundles.add(Mockito.mock(Bundle.class)); @@ -31,7 +31,7 @@ public class BundleInstallationExceptionTestCase { } @Test - public void requireThatBundlesCollectionIsDefensivelyCopied() { + void requireThatBundlesCollectionIsDefensivelyCopied() { Collection<Bundle> bundles = new LinkedList<>(); bundles.add(Mockito.mock(Bundle.class)); BundleInstallationException e = new BundleInstallationException(bundles, new Throwable()); @@ -40,9 +40,9 @@ public class BundleInstallationExceptionTestCase { } @Test - public void requireThatBundlesCollectionIsUnmodifiable() { + void requireThatBundlesCollectionIsUnmodifiable() { BundleInstallationException e = new BundleInstallationException(Arrays.asList(Mockito.mock(Bundle.class)), - new Throwable()); + new Throwable()); try { e.installedBundles().add(Mockito.mock(Bundle.class)); fail(); 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 288b46c995f..a31c72584a5 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 @@ -5,18 +5,18 @@ import com.google.inject.AbstractModule; import com.google.inject.Key; import com.google.inject.name.Names; import com.yahoo.jdisc.test.TestDriver; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.net.URISyntaxException; import java.util.Arrays; import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; /** @@ -25,7 +25,7 @@ import static org.junit.Assert.fail; public class ContainerBuilderTestCase { @Test - public void requireThatAccessorsWork() throws URISyntaxException { + void requireThatAccessorsWork() throws URISyntaxException { final Object obj = new Object(); TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi(new AbstractModule() { @@ -47,7 +47,7 @@ public class ContainerBuilderTestCase { } @Test - public void requireThatContainerThreadFactoryIsBound() { + void requireThatContainerThreadFactoryIsBound() { TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi(); ContainerBuilder builder = driver.newContainerBuilder(); assertSame(ContainerThread.Factory.class, builder.getInstance(ThreadFactory.class).getClass()); @@ -55,7 +55,7 @@ public class ContainerBuilderTestCase { } @Test - public void requireThatThreadFactoryCanBeReconfigured() { + void requireThatThreadFactoryCanBeReconfigured() { final ThreadFactory factory = Executors.defaultThreadFactory(); TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi(); ContainerBuilder builder = driver.newContainerBuilder(); @@ -71,7 +71,7 @@ public class ContainerBuilderTestCase { } @Test - public void requireThatBindingSetsAreCreatedOnDemand() { + void requireThatBindingSetsAreCreatedOnDemand() { TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi(); ContainerBuilder builder = driver.newContainerBuilder(); BindingRepository<?> repo = builder.serverBindings("foo"); @@ -87,12 +87,12 @@ public class ContainerBuilderTestCase { } @Test - public void requireThatSafeClassCastWorks() { + void requireThatSafeClassCastWorks() { ContainerBuilder.safeClassCast(Integer.class, Integer.class); } @Test - public void requireThatSafeClassCastThrowsIllegalArgument() { + void requireThatSafeClassCastThrowsIllegalArgument() { try { ContainerBuilder.safeClassCast(Integer.class, Double.class); fail(); @@ -102,7 +102,7 @@ public class ContainerBuilderTestCase { } @Test - public void requireThatSafeStringSplitWorks() { + void requireThatSafeStringSplitWorks() { assertTrue(ContainerBuilder.safeStringSplit(new Object(), ",").isEmpty()); assertTrue(ContainerBuilder.safeStringSplit("", ",").isEmpty()); assertTrue(ContainerBuilder.safeStringSplit(" \f\n\r\t", ",").isEmpty()); diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/application/ContainerThreadTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/application/ContainerThreadTestCase.java index c7780808bf6..4d17b285926 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/application/ContainerThreadTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/application/ContainerThreadTestCase.java @@ -2,13 +2,13 @@ package com.yahoo.jdisc.application; import com.yahoo.jdisc.Metric; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Map; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import static org.junit.Assert.assertSame; +import static org.junit.jupiter.api.Assertions.assertSame; /** @@ -17,14 +17,14 @@ import static org.junit.Assert.assertSame; public class ContainerThreadTestCase { @Test - public void requireThatAccessorsWork() { + void requireThatAccessorsWork() { MetricConsumer consumer = new MyConsumer(); ContainerThread thread = new ContainerThread(new MyTask(), consumer); assertSame(consumer, thread.consumer()); } @Test - public void requireThatTaskIsRun() throws InterruptedException { + void requireThatTaskIsRun() throws InterruptedException { MyTask task = new MyTask(); ContainerThread thread = new ContainerThread(task, null); thread.start(); 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 abe47662970..8a01406940f 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 @@ -1,18 +1,18 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.jdisc.application; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author Simon Thoresen Hult @@ -20,7 +20,7 @@ import static org.junit.Assert.assertTrue; public class GlobPatternTestCase { @Test - public void requireThatCompileCreatesExpectedParts() { + void requireThatCompileCreatesExpectedParts() { assertToString("foo"); assertToString("*foo"); assertToString("*oo"); @@ -38,7 +38,7 @@ public class GlobPatternTestCase { } @Test - public void requireThatGlobMatcherWorks() { + void requireThatGlobMatcherWorks() { assertMatch("foo", "foo", Collections.<String>emptyList()); assertNotMatch("foo", "bar"); @@ -81,7 +81,7 @@ public class GlobPatternTestCase { } @Test - public void requireThatGlobPatternOrdersMoreSpecificFirst() { + void requireThatGlobPatternOrdersMoreSpecificFirst() { assertCompareEq("foo", "foo"); assertCompareLt("foo", "foo*"); assertCompareLt("foo", "*foo"); @@ -112,15 +112,15 @@ public class GlobPatternTestCase { } @Test - public void requireThatEqualsIsImplemented() { - assertTrue(GlobPattern.compile("foo").equals(GlobPattern.compile("foo"))); - assertFalse(GlobPattern.compile("foo").equals(GlobPattern.compile("bar"))); + void requireThatEqualsIsImplemented() { + assertEquals(GlobPattern.compile("foo"), GlobPattern.compile("foo")); + assertNotEquals(GlobPattern.compile("foo"), GlobPattern.compile("bar")); } @Test - public void requireThatHashCodeIsImplemented() { - assertTrue(GlobPattern.compile("foo").hashCode() == GlobPattern.compile("foo").hashCode()); - assertFalse(GlobPattern.compile("foo").hashCode() == GlobPattern.compile("bar").hashCode()); + void requireThatHashCodeIsImplemented() { + assertEquals(GlobPattern.compile("foo").hashCode(), GlobPattern.compile("foo").hashCode()); + assertNotNull(GlobPattern.compile("bar").hashCode()); } private static void assertCompareLt(String lhs, String rhs) { 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 11857163970..9e100e3346a 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 @@ -10,18 +10,18 @@ import com.google.inject.Module; import com.google.inject.PrivateModule; import com.google.inject.name.Named; import com.google.inject.name.Names; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Arrays; import java.util.Iterator; import java.util.List; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; /** @@ -30,7 +30,7 @@ import static org.junit.Assert.fail; public class GuiceRepositoryTestCase { @Test - public void requireThatInstallWorks() { + void requireThatInstallWorks() { GuiceRepository guice = new GuiceRepository(); StringBinding module = new StringBinding("fooKey", "fooVal"); guice.install(module); @@ -43,7 +43,7 @@ public class GuiceRepositoryTestCase { } @Test - public void requireThatInstallAllWorks() { + void requireThatInstallAllWorks() { GuiceRepository guice = new GuiceRepository(); StringBinding foo = new StringBinding("fooKey", "fooVal"); StringBinding bar = new StringBinding("barKey", "barVal"); @@ -60,7 +60,7 @@ public class GuiceRepositoryTestCase { } @Test - public void requireThatUninstallWorks() { + void requireThatUninstallWorks() { GuiceRepository guice = new GuiceRepository(); StringBinding module = new StringBinding("fooKey", "fooVal"); guice.install(module); @@ -72,7 +72,7 @@ public class GuiceRepositoryTestCase { } @Test - public void requireThatUninstallAllWorks() { + void requireThatUninstallAllWorks() { GuiceRepository guice = new GuiceRepository(); StringBinding foo = new StringBinding("fooKey", "fooVal"); StringBinding bar = new StringBinding("barKey", "barVal"); @@ -95,7 +95,7 @@ public class GuiceRepositoryTestCase { } @Test - public void requireThatBindingsCanBeOverridden() { + void requireThatBindingsCanBeOverridden() { GuiceRepository guice = new GuiceRepository(); guice.install(new StringBinding("fooKey", "fooVal1")); assertBinding(guice, "fooKey", "fooVal1"); @@ -104,7 +104,7 @@ public class GuiceRepositoryTestCase { } @Test - public void requireThatModulesAreOnlyEvaluatedOnce() { + void requireThatModulesAreOnlyEvaluatedOnce() { GuiceRepository guice = new GuiceRepository(); EvalCounter foo = new EvalCounter(); EvalCounter bar = new EvalCounter(); @@ -119,18 +119,18 @@ public class GuiceRepositoryTestCase { } @Test - public void requireThatPrivateModulesWorks() { + void requireThatPrivateModulesWorks() { GuiceRepository guice = new GuiceRepository(); List<Named> names = Arrays.asList(Names.named("A"), Names.named("B")); - for (Named name: names) { + for (Named name : names) { guice.install(createPrivateInjectNameModule(name)); } Injector injector = guice.getInjector(); - for (Named name: names) { + for (Named name : names) { NameHolder nameHolder = injector.getInstance(Key.get(NameHolder.class, name)); assertEquals(name, nameHolder.name); } diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/application/MetricImplTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/application/MetricImplTestCase.java index 29c51760347..33897d8eacc 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/application/MetricImplTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/application/MetricImplTestCase.java @@ -5,7 +5,7 @@ import com.google.inject.AbstractModule; import com.google.inject.Guice; import com.google.inject.Injector; import com.yahoo.jdisc.Metric; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -14,8 +14,8 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; -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; /** @@ -24,13 +24,13 @@ import static org.junit.Assert.assertTrue; public class MetricImplTestCase { @Test - public void requireThatClassIsInjectedByDefault() { + void requireThatClassIsInjectedByDefault() { Metric metric = Guice.createInjector().getInstance(Metric.class); assertTrue(metric instanceof MetricImpl); } @Test - public void requireThatConsumerIsOptional() { + void requireThatConsumerIsOptional() { Injector injector = Guice.createInjector(); Metric metric = injector.getInstance(Metric.class); metric.set("foo", 6, null); @@ -38,7 +38,7 @@ public class MetricImplTestCase { } @Test - public void requireThatConsumerIsCalled() throws InterruptedException { + void requireThatConsumerIsCalled() throws InterruptedException { final MyConsumer consumer = new MyConsumer(); Injector injector = Guice.createInjector(new AbstractModule() { @@ -57,7 +57,7 @@ public class MetricImplTestCase { } @Test - public void requireThatWorkerMetricHasPrecedence() throws InterruptedException { + void requireThatWorkerMetricHasPrecedence() throws InterruptedException { final MyConsumer globalConsumer = new MyConsumer(); Injector injector = Guice.createInjector(new AbstractModule() { diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/application/OsgiHeaderTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/application/OsgiHeaderTestCase.java index da1ab024ede..111ae868e05 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/application/OsgiHeaderTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/application/OsgiHeaderTestCase.java @@ -1,9 +1,9 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.jdisc.application; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; /** @@ -12,7 +12,7 @@ import static org.junit.Assert.assertEquals; public class OsgiHeaderTestCase { @Test - public void requireThatOsgiHeadersDoNotChange() { + void requireThatOsgiHeadersDoNotChange() { assertEquals("X-JDisc-Application", OsgiHeader.APPLICATION); assertEquals("X-JDisc-Preinstall-Bundle", OsgiHeader.PREINSTALL_BUNDLE); assertEquals("X-JDisc-Privileged-Activator", OsgiHeader.PRIVILEGED_ACTIVATOR); diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/application/OsgiRepositoryTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/application/OsgiRepositoryTestCase.java index b57fc5ae31f..49d76172c39 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/application/OsgiRepositoryTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/application/OsgiRepositoryTestCase.java @@ -1,9 +1,9 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.jdisc.application; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; /** @@ -12,7 +12,7 @@ import static org.junit.Assert.assertTrue; public class OsgiRepositoryTestCase { @Test - public void requireNothingSinceIntegrationModuleTestsThis() { + void requireNothingSinceIntegrationModuleTestsThis() { assertTrue(true); } } diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/application/ResourcePoolTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/application/ResourcePoolTestCase.java index b94ff063fc7..d422a6c45e5 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/application/ResourcePoolTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/application/ResourcePoolTestCase.java @@ -6,12 +6,12 @@ import com.google.inject.Key; import com.yahoo.jdisc.AbstractResource; import com.yahoo.jdisc.ResourceReference; import com.yahoo.jdisc.test.TestDriver; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; /** @@ -20,7 +20,7 @@ import static org.junit.Assert.fail; public class ResourcePoolTestCase { @Test - public void requireThatAddReturnsArgument() { + void requireThatAddReturnsArgument() { TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi(); MyResource foo = new MyResource(); assertSame(foo, new ResourcePool(driver.newContainerBuilder()).add(foo)); @@ -28,7 +28,7 @@ public class ResourcePoolTestCase { } @Test - public void requireThatAddDoesNotRetainArgument() { + void requireThatAddDoesNotRetainArgument() { TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi(); MyResource foo = new MyResource(); assertEquals(1, foo.retainCount()); @@ -38,12 +38,12 @@ public class ResourcePoolTestCase { } @Test - public void requireThatAddCanBeUsedWithoutContainerBuilder() { + void requireThatAddCanBeUsedWithoutContainerBuilder() { new ResourcePool().add(new MyResource()); } @Test - public void requireThatRetainReturnsArgument() { + void requireThatRetainReturnsArgument() { TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi(); MyResource foo = new MyResource(); assertSame(foo, new ResourcePool(driver.newContainerBuilder()).retain(foo)); @@ -51,7 +51,7 @@ public class ResourcePoolTestCase { } @Test - public void requireThatRetainRetainsArgument() { + void requireThatRetainRetainsArgument() { TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi(); MyResource foo = new MyResource(); assertEquals(1, foo.retainCount()); @@ -61,12 +61,12 @@ public class ResourcePoolTestCase { } @Test - public void requireThatRetainCanBeUsedWithoutContainerBuilder() { + void requireThatRetainCanBeUsedWithoutContainerBuilder() { new ResourcePool().retain(new MyResource()); } @Test - public void requireThatGetReturnsBoundInstance() { + void requireThatGetReturnsBoundInstance() { final MyResource foo = new MyResource(); TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi(new AbstractModule() { @@ -82,7 +82,7 @@ public class ResourcePoolTestCase { } @Test - public void requireThatGetDoesNotRetainArgument() { + void requireThatGetDoesNotRetainArgument() { final MyResource foo = new MyResource(); assertEquals(1, foo.retainCount()); TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi(new AbstractModule() { @@ -101,7 +101,7 @@ public class ResourcePoolTestCase { } @Test - public void requireThatGetCanNotBeUsedWithoutContainerBuilder() { + void requireThatGetCanNotBeUsedWithoutContainerBuilder() { ResourcePool pool = new ResourcePool(); try { pool.get(MyResource.class); @@ -118,7 +118,7 @@ public class ResourcePoolTestCase { } @Test - public void requireThatResourcesAreReleasedOnDestroy() { + void requireThatResourcesAreReleasedOnDestroy() { TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi(); ResourcePool pool = new ResourcePool(driver.newContainerBuilder()); @@ -152,7 +152,7 @@ public class ResourcePoolTestCase { } @Test - public void requireThatAutoCloseCallsRelease() throws Exception { + void requireThatAutoCloseCallsRelease() throws Exception { MyResource foo = new MyResource(); assertEquals(1, foo.retainCount()); try (ResourcePool pool = new ResourcePool()) { 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 a5d7184e31a..cb3a81277f3 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 @@ -3,15 +3,15 @@ package com.yahoo.jdisc.application; import com.yahoo.jdisc.NoopSharedResource; import com.yahoo.jdisc.service.ServerProvider; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Arrays; import java.util.Iterator; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author Simon Thoresen Hult @@ -19,7 +19,7 @@ import static org.junit.Assert.assertTrue; public class ServerRepositoryTestCase { @Test - public void requireThatInstallWorks() { + void requireThatInstallWorks() { ServerRepository servers = newServerRepository(); MyServer server = new MyServer(); servers.install(server); @@ -31,7 +31,7 @@ public class ServerRepositoryTestCase { } @Test - public void requireThatInstallAllWorks() { + void requireThatInstallAllWorks() { ServerRepository servers = newServerRepository(); ServerProvider foo = new MyServer(); ServerProvider bar = new MyServer(); @@ -46,7 +46,7 @@ public class ServerRepositoryTestCase { } @Test - public void requireThatUninstallWorks() { + void requireThatUninstallWorks() { ServerRepository servers = newServerRepository(); ServerProvider server = new MyServer(); servers.install(server); @@ -55,7 +55,7 @@ public class ServerRepositoryTestCase { } @Test - public void requireThatUninstallAllWorks() { + void requireThatUninstallAllWorks() { ServerRepository servers = newServerRepository(); ServerProvider foo = new MyServer(); ServerProvider bar = new MyServer(); 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 32327ace4f4..7a67aeda5f8 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 @@ -1,7 +1,7 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.jdisc.application; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.net.URI; import java.util.ArrayList; @@ -9,11 +9,11 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; /** * @author Simon Thoresen Hult @@ -23,7 +23,7 @@ public class UriPatternTestCase { private static final List<String> NO_GROUPS = Collections.emptyList(); @Test - public void requireThatIllegalPatternsAreDetected() { + void requireThatIllegalPatternsAreDetected() { assertIllegalPattern("scheme"); assertIllegalPattern("scheme://"); assertIllegalPattern("scheme://host"); @@ -36,13 +36,13 @@ public class UriPatternTestCase { } @Test - public void requireThatNoPortImpliesWildcard() { + void requireThatNoPortImpliesWildcard() { assertEquals(new UriPattern("scheme://host/path"), - new UriPattern("scheme://host:*/path")); + new UriPattern("scheme://host:*/path")); } @Test - public void requireThatPatternMatches() { + void requireThatPatternMatches() { // scheme matching UriPattern pattern = new UriPattern("bar://host:69/path"); assertNotMatch(pattern, "foobar://host:69/path"); @@ -124,7 +124,7 @@ public class UriPatternTestCase { } @Test - public void requireThatUriWithoutPathDoesNotThrowException() { + void requireThatUriWithoutPathDoesNotThrowException() { UriPattern pattern = new UriPattern("scheme://host/path"); assertNotMatch(pattern, "scheme://host"); @@ -133,123 +133,123 @@ public class UriPatternTestCase { } @Test - public void requireThatOnlySchemeHostPortAndPathIsMatched() { + void requireThatOnlySchemeHostPortAndPathIsMatched() { UriPattern pattern = new UriPattern("scheme://host:69/path"); assertMatch(pattern, "scheme://host:69/path?foo", NO_GROUPS); assertMatch(pattern, "scheme://host:69/path?foo#bar", NO_GROUPS); } @Test - public void requireThatHostSupportsWildcard() { + 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")); } @Test - public void requireThatSchemesAreOrdered() { + void requireThatSchemesAreOrdered() { assertCompareLt("b://host:69/path", - "a://host:69/path"); + "a://host:69/path"); } @Test - public void requireThatSchemeOrdersBeforeHost() { + void requireThatSchemeOrdersBeforeHost() { assertCompareLt("b://*:69/path", - "a://host:69/path"); + "a://host:69/path"); } @Test - public void requireThatHostsAreOrdered() { + void requireThatHostsAreOrdered() { assertCompareLt("scheme://b:69/path", - "scheme://a:69/path"); + "scheme://a:69/path"); } @Test - public void requireThatHostOrdersBeforePath() { + void requireThatHostOrdersBeforePath() { assertCompareLt("scheme://b:69/*", - "scheme://a:69/path"); + "scheme://a:69/path"); } @Test - public void requireThatPortsAreOrdered() { + void requireThatPortsAreOrdered() { for (int i = 1; i < 69; ++i) { assertCompareEq("scheme://host:" + i + "/path", - "scheme://host:" + i + "/path"); + "scheme://host:" + i + "/path"); assertCompareLt("scheme://host:" + (i + 1) + "/path", - "scheme://host:" + i + "/path"); + "scheme://host:" + i + "/path"); assertCompareLt("scheme://host:" + i + "/path", - "scheme://host:*/path"); + "scheme://host:*/path"); } } @Test - public void requireThatPathsAreOrdered() { + void requireThatPathsAreOrdered() { assertCompareLt("scheme://host:69/b", - "scheme://host:69/a"); + "scheme://host:69/a"); } @Test - public void requireThatPathOrdersBeforePort() { + void requireThatPathOrdersBeforePort() { assertCompareLt("scheme://host:*/b", - "scheme://host:69/a"); + "scheme://host:69/a"); } @Test - public void requireThatEqualPatternsOrderEqual() { + void requireThatEqualPatternsOrderEqual() { assertCompareEq("scheme://host:69/path", - "scheme://host:69/path"); + "scheme://host:69/path"); assertCompareEq("*://host:69/path", - "*://host:69/path"); + "*://host:69/path"); assertCompareEq("scheme://*:69/path", - "scheme://*:69/path"); + "scheme://*:69/path"); assertCompareEq("scheme://host:*/path", - "scheme://host:*/path"); + "scheme://host:*/path"); assertCompareEq("scheme://host:69/*", - "scheme://host:69/*"); + "scheme://host:69/*"); } @Test - public void requireThatStrictPatternsOrderBeforeWildcards() { + void requireThatStrictPatternsOrderBeforeWildcards() { assertCompareLt("scheme://host:69/path", - "*://host:69/path"); + "*://host:69/path"); assertCompareLt("scheme://a:69/path", - "scheme://*:69/path"); + "scheme://*:69/path"); assertCompareLt("scheme://a:69/path", - "scheme://*a:69/path"); + "scheme://*a:69/path"); assertCompareLt("scheme://*aa:69/path", - "scheme://*a:69/path"); + "scheme://*a:69/path"); assertCompareLt("scheme://host:69/path", - "scheme://host:*/path"); + "scheme://host:*/path"); assertCompareLt("scheme://host:69/a", - "scheme://host:69/*"); + "scheme://host:69/*"); assertCompareLt("scheme://host:69/a", - "scheme://host:69/a*"); + "scheme://host:69/a*"); assertCompareLt("scheme://host:69/aa*", - "scheme://host:69/a*"); + "scheme://host:69/a*"); assertCompareLt("scheme://*:69/path", - "*://host:69/path"); + "*://host:69/path"); assertCompareLt("scheme://host:*/path", - "scheme://*:69/path"); + "scheme://*:69/path"); assertCompareLt("scheme://host:*/path", - "scheme://host:69/*"); + "scheme://host:69/*"); assertCompareLt("scheme://host:69/foo", - "scheme://host:69/*"); + "scheme://host:69/*"); assertCompareLt("scheme://host:69/foo/bar", - "scheme://host:69/foo/*"); + "scheme://host:69/foo/*"); assertCompareLt("scheme://host:69/foo/bar/baz", - "scheme://host:69/foo/bar/*"); + "scheme://host:69/foo/bar/*"); } @Test - public void requireThatLongPatternsOrderBeforeShort() { + void requireThatLongPatternsOrderBeforeShort() { assertCompareLt("scheme://host:69/foo/bar", - "scheme://host:69/foo"); + "scheme://host:69/foo"); assertCompareLt("scheme://host:69/foo/bar/baz", - "scheme://host:69/foo/bar"); + "scheme://host:69/foo/bar"); } @Test - public void requireThatHttpsSchemeIsHandledAsHttp() { + void requireThatHttpsSchemeIsHandledAsHttp() { UriPattern httpPattern = new UriPattern("http://host:80/path"); assertMatch(httpPattern, "https://host:80/path", NO_GROUPS); @@ -258,7 +258,7 @@ public class UriPatternTestCase { } @Test - public void requireThatUrlEncodingIsNotDoneForPath() { + void requireThatUrlEncodingIsNotDoneForPath() { UriPattern encodedSlashPattern = new UriPattern("http://host:80/one%2Fpath"); assertMatch(encodedSlashPattern, "http://host:80/one%2Fpath", NO_GROUPS); assertNotMatch(encodedSlashPattern, "http://host:80/one/path"); @@ -304,7 +304,7 @@ public class UriPatternTestCase { assertTrue(rhsCmp < 0); return 1; } - assertTrue(rhsCmp == 0); + assertEquals(rhsCmp, 0); return 0; } |