summaryrefslogtreecommitdiffstats
path: root/jdisc_core/src/test/java/com/yahoo/jdisc/core
diff options
context:
space:
mode:
Diffstat (limited to 'jdisc_core/src/test/java/com/yahoo/jdisc/core')
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/ActiveContainerTestCase.java23
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationConfigModuleTestCase.java19
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationEnvironmentModuleTestCase.java12
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationLoaderTestCase.java40
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationRestartTestCase.java10
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationShutdownTestCase.java10
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/BundleLocationResolverTestCase.java22
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/ConsoleLogFormatterTestCase.java114
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/ConsoleLogListenerTestCase.java28
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/ConsoleLogManagerTestCase.java16
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/ContainerResourceTestCase.java14
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/ContainerShutdownTestCase.java78
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/ContainerSnapshotTestCase.java24
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/ContainerTerminationTestCase.java18
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/ContainerWatchdogTest.java6
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/DefaultBindingSelectorTestCase.java10
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/ExportPackagesIT.java24
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/FelixFrameworkTestCase.java10
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/FelixParamsTestCase.java14
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogHandlerTestCase.java47
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogManagerTestCase.java16
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogServiceTestCase.java20
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/ScheduledQueueTestCase.java28
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/SystemTimerTestCase.java8
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/core/TimeoutManagerImplTestCase.java54
25 files changed, 333 insertions, 332 deletions
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ActiveContainerTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ActiveContainerTestCase.java
index cf1fa62b102..4232b6ed087 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ActiveContainerTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ActiveContainerTestCase.java
@@ -14,12 +14,13 @@ import com.yahoo.jdisc.test.TestDriver;
import java.util.Iterator;
import java.util.Map;
-import org.junit.Test;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
+import org.junit.jupiter.api.Test;
+
+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.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
* @author Simon Thoresen Hult
@@ -27,7 +28,7 @@ import static org.junit.Assert.assertSame;
public class ActiveContainerTestCase {
@Test
- public void requireThatGuiceAccessorWorks() {
+ void requireThatGuiceAccessorWorks() {
final Object obj = new Object();
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi(new AbstractModule() {
@@ -42,7 +43,7 @@ public class ActiveContainerTestCase {
}
@Test
- public void requireThatServerAccessorWorks() {
+ void requireThatServerAccessorWorks() {
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
ContainerBuilder builder = driver.newContainerBuilder();
ServerProvider foo = new NonWorkingServerProvider();
@@ -61,7 +62,7 @@ public class ActiveContainerTestCase {
}
@Test
- public void requireThatServerBindingAccessorWorks() {
+ void requireThatServerBindingAccessorWorks() {
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
ContainerBuilder builder = driver.newContainerBuilder();
RequestHandler foo = new NonWorkingRequestHandler();
@@ -103,7 +104,7 @@ public class ActiveContainerTestCase {
}
@Test
- public void requireThatClientBindingAccessorWorks() {
+ void requireThatClientBindingAccessorWorks() {
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
ContainerBuilder builder = driver.newContainerBuilder();
RequestHandler foo = new NonWorkingRequestHandler();
@@ -145,7 +146,7 @@ public class ActiveContainerTestCase {
}
@Test
- public void requireThatDefaultBindingsAreAlwaysCreated() {
+ void requireThatDefaultBindingsAreAlwaysCreated() {
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
ContainerBuilder builder = driver.newContainerBuilder();
ActiveContainer container = new ActiveContainer(builder);
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationConfigModuleTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationConfigModuleTestCase.java
index d17c5b183d8..8a1d155df2c 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationConfigModuleTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationConfigModuleTestCase.java
@@ -15,9 +15,10 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
-import org.junit.Test;
-import static org.junit.Assert.fail;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author Simon Thoresen Hult
@@ -25,7 +26,7 @@ import static org.junit.Assert.assertEquals;
public class ApplicationConfigModuleTestCase {
@Test
- public void requireThatEntriesAreBoundWithLowerCaseKeys() {
+ void requireThatEntriesAreBoundWithLowerCaseKeys() {
Map<String, String> config = new HashMap<>();
config.put("foo_key", "foo");
config.put("BAR_key", "bar");
@@ -38,7 +39,7 @@ public class ApplicationConfigModuleTestCase {
}
@Test
- public void requireThatEntriesAreBoundWithUnmodifiedValue() {
+ void requireThatEntriesAreBoundWithUnmodifiedValue() {
Map<String, String> config = new HashMap<>();
config.put("foo", "foo_val");
config.put("bar", "BAR_val");
@@ -51,7 +52,7 @@ public class ApplicationConfigModuleTestCase {
}
@Test
- public void requireThatUpperCaseKeysPrecedeLowerCaseKeys() {
+ void requireThatUpperCaseKeysPrecedeLowerCaseKeys() {
Map<String, String> config = new HashMap<>();
config.put("foo", "lower-case");
assertBinding(config, "foo", "lower-case");
@@ -67,7 +68,7 @@ public class ApplicationConfigModuleTestCase {
}
@Test
- public void requireThatNullFileNameThrowsException() throws IOException {
+ void requireThatNullFileNameThrowsException() throws IOException {
try {
ApplicationConfigModule.newInstanceFromFile(null);
fail();
@@ -77,7 +78,7 @@ public class ApplicationConfigModuleTestCase {
}
@Test
- public void requireThatFileNotFoundThrowsException() throws IOException {
+ void requireThatFileNotFoundThrowsException() throws IOException {
try {
ApplicationConfigModule.newInstanceFromFile("/file/not/found");
fail();
@@ -87,7 +88,7 @@ public class ApplicationConfigModuleTestCase {
}
@Test
- public void requireThatPropertieFilesCanBeRead() throws IOException {
+ void requireThatPropertieFilesCanBeRead() throws IOException {
Properties props = new Properties();
props.put("foo_key", "foo_val");
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationEnvironmentModuleTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationEnvironmentModuleTestCase.java
index 3bd60832ca3..87a0d4d0e18 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationEnvironmentModuleTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationEnvironmentModuleTestCase.java
@@ -10,7 +10,7 @@ import com.yahoo.jdisc.application.ContainerBuilder;
import com.yahoo.jdisc.application.OsgiFramework;
import com.yahoo.jdisc.service.CurrentContainer;
import com.yahoo.jdisc.test.NonWorkingOsgiFramework;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.LinkedList;
import java.util.List;
@@ -18,8 +18,8 @@ import java.util.Map;
import java.util.concurrent.ThreadFactory;
import static java.util.Collections.emptyList;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author Simon Thoresen Hult
@@ -27,7 +27,7 @@ import static org.junit.Assert.assertTrue;
public class ApplicationEnvironmentModuleTestCase {
@Test
- public void requireThatBindingsExist() {
+ void requireThatBindingsExist() {
List<Class<?>> expected = new LinkedList<>();
expected.add(ContainerActivator.class);
expected.add(ContainerBuilder.class);
@@ -49,10 +49,10 @@ public class ApplicationEnvironmentModuleTestCase {
}
@Test
- public void requireThatContainerBuilderCanBeInjected() {
+ void requireThatContainerBuilderCanBeInjected() {
ApplicationLoader loader = new ApplicationLoader(new NonWorkingOsgiFramework(), emptyList());
assertNotNull(new ApplicationEnvironmentModule(loader).containerBuilder());
assertNotNull(Guice.createInjector(new ApplicationEnvironmentModule(loader))
- .getInstance(ContainerBuilder.class));
+ .getInstance(ContainerBuilder.class));
}
}
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationLoaderTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationLoaderTestCase.java
index e5d335beb38..301f0fc571e 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationLoaderTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationLoaderTestCase.java
@@ -16,7 +16,7 @@ import com.yahoo.jdisc.handler.ResponseHandler;
import com.yahoo.jdisc.service.CurrentContainer;
import com.yahoo.jdisc.test.NonWorkingOsgiFramework;
import com.yahoo.jdisc.test.TestDriver;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.osgi.framework.BundleContext;
import java.nio.ByteBuffer;
@@ -27,12 +27,12 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
-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.Assert.fail;
+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;
+import static org.junit.jupiter.api.Assertions.fail;
/**
@@ -41,9 +41,9 @@ import static org.junit.Assert.fail;
public class ApplicationLoaderTestCase {
@Test
- public void requireThatStartFailsWithoutApplication() throws Exception {
+ void requireThatStartFailsWithoutApplication() throws Exception {
ApplicationLoader loader = new ApplicationLoader(new NonWorkingOsgiFramework(),
- Collections.<Module>emptyList());
+ Collections.<Module>emptyList());
try {
loader.init(null, false);
loader.start();
@@ -54,25 +54,25 @@ public class ApplicationLoaderTestCase {
}
@Test
- public void requireThatStopDoesNotFailWithoutStart() throws Exception {
+ void requireThatStopDoesNotFailWithoutStart() throws Exception {
ApplicationLoader loader = new ApplicationLoader(new NonWorkingOsgiFramework(),
- Collections.<Module>emptyList());
+ Collections.<Module>emptyList());
loader.stop();
loader.destroy();
}
@Test
- public void requireThatDestroyDoesNotFailWithActiveContainer() throws Exception {
+ void requireThatDestroyDoesNotFailWithActiveContainer() throws Exception {
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
assertNull(driver.activateContainer(driver.newContainerBuilder()));
assertTrue(driver.close());
}
@Test
- public void requireThatApplicationStartExceptionUnsetsAndDestroysApplication() throws Exception {
+ void requireThatApplicationStartExceptionUnsetsAndDestroysApplication() throws Exception {
MyApplication app = MyApplication.newStartException();
ApplicationLoader loader = new ApplicationLoader(new NonWorkingOsgiFramework(),
- Arrays.asList(new MyApplicationModule(app)));
+ Arrays.asList(new MyApplicationModule(app)));
loader.init(null, false);
try {
loader.start();
@@ -94,10 +94,10 @@ public class ApplicationLoaderTestCase {
}
@Test
- public void requireThatApplicationStopExceptionDestroysApplication() throws Exception {
+ void requireThatApplicationStopExceptionDestroysApplication() throws Exception {
MyApplication app = MyApplication.newStopException();
ApplicationLoader loader = new ApplicationLoader(new NonWorkingOsgiFramework(),
- Arrays.asList(new MyApplicationModule(app)));
+ Arrays.asList(new MyApplicationModule(app)));
loader.init(null, false);
loader.start();
try {
@@ -110,7 +110,7 @@ public class ApplicationLoaderTestCase {
}
@Test
- public void requireThatApplicationDestroyIsCalledAfterContainerTermination() throws InterruptedException {
+ void requireThatApplicationDestroyIsCalledAfterContainerTermination() throws InterruptedException {
MyApplication app = MyApplication.newInstance();
TestDriver driver = TestDriver.newInjectedApplicationInstance(app);
ContainerBuilder builder = driver.newContainerBuilder();
@@ -125,7 +125,7 @@ public class ApplicationLoaderTestCase {
}
@Test
- public void requireThatContainerActivatorReturnsPrev() throws Exception {
+ void requireThatContainerActivatorReturnsPrev() throws Exception {
TestDriver driver = TestDriver.newInjectedApplicationInstance(MyApplication.newInstance());
assertNull(driver.activateContainer(driver.newContainerBuilder()));
assertNotNull(driver.activateContainer(null));
@@ -133,7 +133,7 @@ public class ApplicationLoaderTestCase {
}
@Test
- public void requireThatOsgiServicesAreRegistered() {
+ void requireThatOsgiServicesAreRegistered() {
TestDriver driver = TestDriver.newSimpleApplicationInstance();
BundleContext ctx = driver.osgiFramework().bundleContext();
Object service = ctx.getService(ctx.getServiceReference(CurrentContainer.class.getName()));
@@ -142,7 +142,7 @@ public class ApplicationLoaderTestCase {
}
@Test
- public void requireThatThreadFactoryCanBeBound() {
+ void requireThatThreadFactoryCanBeBound() {
final ThreadFactory factory = Executors.defaultThreadFactory();
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi(new AbstractModule() {
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationRestartTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationRestartTestCase.java
index 941067ff27d..cf283fa3ae3 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationRestartTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationRestartTestCase.java
@@ -11,7 +11,7 @@ import com.yahoo.jdisc.handler.CompletionHandler;
import com.yahoo.jdisc.handler.ContentChannel;
import com.yahoo.jdisc.handler.ResponseHandler;
import com.yahoo.jdisc.test.NonWorkingOsgiFramework;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.net.URI;
import java.nio.ByteBuffer;
@@ -19,8 +19,8 @@ import java.util.Arrays;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
@@ -29,7 +29,7 @@ import static org.junit.Assert.assertTrue;
public class ApplicationRestartTestCase {
@Test
- public void requireThatStopStartDoesNotBreakShutdown() throws Exception {
+ void requireThatStopStartDoesNotBreakShutdown() throws Exception {
ApplicationLoader loader = newApplicationLoader();
loader.init(null, false);
loader.start();
@@ -40,7 +40,7 @@ public class ApplicationRestartTestCase {
}
@Test
- public void requireThatDestroyInitDoesNotBreakShutdown() throws Exception {
+ void requireThatDestroyInitDoesNotBreakShutdown() throws Exception {
ApplicationLoader loader = newApplicationLoader();
loader.init(null, false);
loader.start();
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationShutdownTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationShutdownTestCase.java
index 3f906263867..fb88f5567e7 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationShutdownTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationShutdownTestCase.java
@@ -10,14 +10,14 @@ import com.yahoo.jdisc.handler.ContentChannel;
import com.yahoo.jdisc.handler.RequestHandler;
import com.yahoo.jdisc.handler.ResponseHandler;
import com.yahoo.jdisc.test.TestDriver;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.net.URI;
import java.nio.ByteBuffer;
import java.util.concurrent.TimeUnit;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author Simon Thoresen Hult
@@ -25,7 +25,7 @@ import static org.junit.Assert.assertTrue;
public class ApplicationShutdownTestCase {
@Test
- public void requireThatStopWaitsForPreviousContainer() throws Exception {
+ void requireThatStopWaitsForPreviousContainer() throws Exception {
Context ctx = new Context();
MyRequestHandler requestHandler = new MyRequestHandler();
ctx.activateContainer(requestHandler);
@@ -38,7 +38,7 @@ public class ApplicationShutdownTestCase {
}
@Test
- public void requireThatStopWaitsForAllPreviousContainers() {
+ void requireThatStopWaitsForAllPreviousContainers() {
Context ctx = new Context();
MyRequestHandler requestHandlerA = new MyRequestHandler();
ctx.activateContainer(requestHandlerA);
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/BundleLocationResolverTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/BundleLocationResolverTestCase.java
index 86f7f5875a7..f65fb849836 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/BundleLocationResolverTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/BundleLocationResolverTestCase.java
@@ -1,12 +1,12 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.core;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.File;
import java.io.IOException;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author Simon Thoresen Hult
@@ -14,13 +14,13 @@ import static org.junit.Assert.assertEquals;
public class BundleLocationResolverTestCase {
@Test
- public void requireThatDollarsAreIncludedInLocation() {
+ void requireThatDollarsAreIncludedInLocation() {
assertLocation("scheme:$foo", "scheme:$foo");
assertLocation("scheme:foo$bar", "scheme:foo$bar");
}
@Test
- public void requireThatCurlyBracesAreIncludedInLocation() {
+ void requireThatCurlyBracesAreIncludedInLocation() {
assertLocation("scheme:{foo", "scheme:{foo");
assertLocation("scheme:foo{", "scheme:foo{");
assertLocation("scheme:foo{bar", "scheme:foo{bar");
@@ -32,14 +32,14 @@ public class BundleLocationResolverTestCase {
}
@Test
- public void requireThatUnterminatedPropertiesAreIncludedInLocation() {
+ void requireThatUnterminatedPropertiesAreIncludedInLocation() {
assertLocation("scheme:${foo", "scheme:${foo");
assertLocation("scheme:foo${", "scheme:foo${");
assertLocation("scheme:foo${bar", "scheme:foo${bar");
}
@Test
- public void requireThatAllSystemPropertiesAreExpanded() throws IOException {
+ void requireThatAllSystemPropertiesAreExpanded() throws IOException {
assertCanonicalPath("", "${foo}");
assertCanonicalPath("barcox", "${foo}bar${baz}cox");
assertCanonicalPath("foobaz", "foo${bar}baz${cox}");
@@ -50,18 +50,18 @@ public class BundleLocationResolverTestCase {
System.setProperty("requireThatAllSystemPropertiesAreExpanded.cox", "COX");
assertCanonicalPath("FOO", "${requireThatAllSystemPropertiesAreExpanded.foo}");
assertCanonicalPath("FOObarBAZcox", "${requireThatAllSystemPropertiesAreExpanded.foo}bar" +
- "${requireThatAllSystemPropertiesAreExpanded.baz}cox");
+ "${requireThatAllSystemPropertiesAreExpanded.baz}cox");
assertCanonicalPath("fooBARbazCOX", "foo${requireThatAllSystemPropertiesAreExpanded.bar}" +
- "baz${requireThatAllSystemPropertiesAreExpanded.cox}");
+ "baz${requireThatAllSystemPropertiesAreExpanded.cox}");
}
@Test
- public void requireThatUnschemedLocationsAreExpandedToBundleLocationProperty() throws IOException {
+ void requireThatUnschemedLocationsAreExpandedToBundleLocationProperty() throws IOException {
assertCanonicalPath(BundleLocationResolver.BUNDLE_PATH + "foo", "foo");
}
@Test
- public void requireThatFileSchemedLocationsAreCanonicalized() throws IOException {
+ void requireThatFileSchemedLocationsAreCanonicalized() throws IOException {
assertCanonicalPath("", "file:");
assertCanonicalPath("foo", "file:foo");
assertCanonicalPath("foo", "file:./foo");
@@ -71,7 +71,7 @@ public class BundleLocationResolverTestCase {
}
@Test
- public void requireThatOtherSchemedLocationsAreUntouched() {
+ void requireThatOtherSchemedLocationsAreUntouched() {
assertLocation("foo:", "foo:");
assertLocation("foo:bar", "foo:bar");
assertLocation("foo:bar/baz", "foo:bar/baz");
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ConsoleLogFormatterTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ConsoleLogFormatterTestCase.java
index f8a982d02cf..64130ddc125 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ConsoleLogFormatterTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ConsoleLogFormatterTestCase.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.core;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;
@@ -13,7 +13,7 @@ import java.io.StringWriter;
import java.io.Writer;
import java.time.Instant;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
@@ -27,178 +27,178 @@ public class ConsoleLogFormatterTestCase {
// TODO: Should (at least) use ConsoleLogFormatter.ABSENCE_REPLACEMENT instead of literal '-'. See ticket 7128315.
@Test
- public void requireThatMillisecondsArePadded() {
+ void requireThatMillisecondsArePadded() {
for (int i = 0; i < 10000; ++i) {
LogEntry entry = new MyEntry(i, 0, null);
Instant instant = Instant.ofEpochMilli(i);
assertEquals(String.format("%d.%06d\t-\t-\t-\t-\tunknown\t", instant.getEpochSecond(), instant.getNano() / 1000),
- SIMPLE_FORMATTER.formatEntry(entry));
+ SIMPLE_FORMATTER.formatEntry(entry));
}
}
@Test
- public void requireThatHostNameIsIncluded() {
+ void requireThatHostNameIsIncluded() {
assertEquals("0.000000\thostName\t-\t-\t-\tunknown\t",
- new ConsoleLogFormatter("hostName", null, null).formatEntry(SIMPLE_ENTRY));
+ new ConsoleLogFormatter("hostName", null, null).formatEntry(SIMPLE_ENTRY));
}
@Test
- public void requireThatHostNameIsOptional() {
+ void requireThatHostNameIsOptional() {
assertEquals("0.000000\t-\t-\t-\t-\tunknown\t",
- new ConsoleLogFormatter(null, null, null).formatEntry(SIMPLE_ENTRY));
+ new ConsoleLogFormatter(null, null, null).formatEntry(SIMPLE_ENTRY));
assertEquals("0.000000\t-\t-\t-\t-\tunknown\t",
- new ConsoleLogFormatter("", null, null).formatEntry(SIMPLE_ENTRY));
+ new ConsoleLogFormatter("", null, null).formatEntry(SIMPLE_ENTRY));
assertEquals("0.000000\t-\t-\t-\t-\tunknown\t",
- new ConsoleLogFormatter(" ", null, null).formatEntry(SIMPLE_ENTRY));
+ new ConsoleLogFormatter(" ", null, null).formatEntry(SIMPLE_ENTRY));
}
@Test
- public void requireThatProcessIdIsIncluded() {
+ void requireThatProcessIdIsIncluded() {
assertEquals("0.000000\t-\tprocessId\t-\t-\tunknown\t",
- new ConsoleLogFormatter(null, "processId", null).formatEntry(SIMPLE_ENTRY));
+ new ConsoleLogFormatter(null, "processId", null).formatEntry(SIMPLE_ENTRY));
}
@Test
- public void requireThatProcessIdIsOptional() {
+ void requireThatProcessIdIsOptional() {
assertEquals("0.000000\t-\t-\t-\t-\tunknown\t",
- new ConsoleLogFormatter(null, null, null).formatEntry(SIMPLE_ENTRY));
+ new ConsoleLogFormatter(null, null, null).formatEntry(SIMPLE_ENTRY));
assertEquals("0.000000\t-\t-\t-\t-\tunknown\t",
- new ConsoleLogFormatter(null, "", null).formatEntry(SIMPLE_ENTRY));
+ new ConsoleLogFormatter(null, "", null).formatEntry(SIMPLE_ENTRY));
assertEquals("0.000000\t-\t-\t-\t-\tunknown\t",
- new ConsoleLogFormatter(null, " ", null).formatEntry(SIMPLE_ENTRY));
+ new ConsoleLogFormatter(null, " ", null).formatEntry(SIMPLE_ENTRY));
}
@Test
- public void requireThatProcessIdIncludesThreadIdWhenAvailable() {
+ void requireThatProcessIdIncludesThreadIdWhenAvailable() {
LogEntry entry = new MyEntry(0, 0, null).putProperty("THREAD_ID", "threadId");
assertEquals("0.000000\t-\tprocessId/threadId\t-\t-\tunknown\t",
- new ConsoleLogFormatter(null, "processId", null).formatEntry(entry));
+ new ConsoleLogFormatter(null, "processId", null).formatEntry(entry));
}
@Test
- public void requireThatServiceNameIsIncluded() {
+ void requireThatServiceNameIsIncluded() {
assertEquals("0.000000\t-\t-\tserviceName\t-\tunknown\t",
- new ConsoleLogFormatter(null, null, "serviceName").formatEntry(SIMPLE_ENTRY));
+ new ConsoleLogFormatter(null, null, "serviceName").formatEntry(SIMPLE_ENTRY));
}
@Test
- public void requireThatServiceNameIsOptional() {
+ void requireThatServiceNameIsOptional() {
assertEquals("0.000000\t-\t-\t-\t-\tunknown\t",
- new ConsoleLogFormatter(null, null, null).formatEntry(SIMPLE_ENTRY));
+ new ConsoleLogFormatter(null, null, null).formatEntry(SIMPLE_ENTRY));
assertEquals("0.000000\t-\t-\t-\t-\tunknown\t",
- new ConsoleLogFormatter(null, null, "").formatEntry(SIMPLE_ENTRY));
+ new ConsoleLogFormatter(null, null, "").formatEntry(SIMPLE_ENTRY));
assertEquals("0.000000\t-\t-\t-\t-\tunknown\t",
- new ConsoleLogFormatter(null, null, " ").formatEntry(SIMPLE_ENTRY));
+ new ConsoleLogFormatter(null, null, " ").formatEntry(SIMPLE_ENTRY));
}
@Test
- public void requireThatBundleNameIsIncluded() {
+ void requireThatBundleNameIsIncluded() {
LogEntry entry = new MyEntry(0, 0, null).setBundleSymbolicName("bundleName");
assertEquals("0.000000\t-\t-\t-\tbundleName\tunknown\t",
- SIMPLE_FORMATTER.formatEntry(entry));
+ SIMPLE_FORMATTER.formatEntry(entry));
}
@Test
- public void requireThatBundleNameIsOptional() {
+ void requireThatBundleNameIsOptional() {
assertEquals("0.000000\t-\t-\t-\t-\tunknown\t",
- SIMPLE_FORMATTER.formatEntry(SIMPLE_ENTRY));
+ SIMPLE_FORMATTER.formatEntry(SIMPLE_ENTRY));
}
@Test
- public void requireThatLoggerNameIsIncluded() {
+ void requireThatLoggerNameIsIncluded() {
LogEntry entry = new MyEntry(0, 0, null).putProperty("LOGGER_NAME", "loggerName");
assertEquals("0.000000\t-\t-\t-\t/loggerName\tunknown\t",
- SIMPLE_FORMATTER.formatEntry(entry));
+ SIMPLE_FORMATTER.formatEntry(entry));
}
@Test
- public void requireThatLoggerNameIsOptional() {
+ void requireThatLoggerNameIsOptional() {
assertEquals("0.000000\t-\t-\t-\t-\tunknown\t",
- SIMPLE_FORMATTER.formatEntry(SIMPLE_ENTRY));
+ SIMPLE_FORMATTER.formatEntry(SIMPLE_ENTRY));
}
@Test
- public void requireThatBundleAndLoggerNameIsCombined() {
+ void requireThatBundleAndLoggerNameIsCombined() {
LogEntry entry = new MyEntry(0, 0, null).setBundleSymbolicName("bundleName")
- .putProperty("LOGGER_NAME", "loggerName");
+ .putProperty("LOGGER_NAME", "loggerName");
assertEquals("0.000000\t-\t-\t-\tbundleName/loggerName\tunknown\t",
- SIMPLE_FORMATTER.formatEntry(entry));
+ SIMPLE_FORMATTER.formatEntry(entry));
}
@Test
- public void requireThatLevelNameIsIncluded() {
+ void requireThatLevelNameIsIncluded() {
ConsoleLogFormatter formatter = SIMPLE_FORMATTER;
assertEquals("0.000000\t-\t-\t-\t-\terror\t",
- formatter.formatEntry(new MyEntry(0, LogService.LOG_ERROR, null)));
+ formatter.formatEntry(new MyEntry(0, LogService.LOG_ERROR, null)));
assertEquals("0.000000\t-\t-\t-\t-\twarning\t",
- formatter.formatEntry(new MyEntry(0, LogService.LOG_WARNING, null)));
+ formatter.formatEntry(new MyEntry(0, LogService.LOG_WARNING, null)));
assertEquals("0.000000\t-\t-\t-\t-\tinfo\t",
- formatter.formatEntry(new MyEntry(0, LogService.LOG_INFO, null)));
+ formatter.formatEntry(new MyEntry(0, LogService.LOG_INFO, null)));
assertEquals("0.000000\t-\t-\t-\t-\tdebug\t",
- formatter.formatEntry(new MyEntry(0, LogService.LOG_DEBUG, null)));
+ formatter.formatEntry(new MyEntry(0, LogService.LOG_DEBUG, null)));
assertEquals("0.000000\t-\t-\t-\t-\tunknown\t",
- formatter.formatEntry(new MyEntry(0, 69, null)));
+ formatter.formatEntry(new MyEntry(0, 69, null)));
}
@Test
- public void requireThatMessageIsIncluded() {
+ void requireThatMessageIsIncluded() {
LogEntry entry = new MyEntry(0, 0, "message");
assertEquals("0.000000\t-\t-\t-\t-\tunknown\tmessage",
- SIMPLE_FORMATTER.formatEntry(entry));
+ SIMPLE_FORMATTER.formatEntry(entry));
}
@Test
- public void requireThatMessageIsOptional() {
+ void requireThatMessageIsOptional() {
LogEntry entry = new MyEntry(0, 0, null);
assertEquals("0.000000\t-\t-\t-\t-\tunknown\t",
- SIMPLE_FORMATTER.formatEntry(entry));
+ SIMPLE_FORMATTER.formatEntry(entry));
}
@Test
- public void requireThatMessageIsEscaped() {
+ void requireThatMessageIsEscaped() {
LogEntry entry = new MyEntry(0, 0, "\\\n\r\t");
assertEquals("0.000000\t-\t-\t-\t-\tunknown\t\\\\\\n\\r\\t",
- SIMPLE_FORMATTER.formatEntry(entry));
+ SIMPLE_FORMATTER.formatEntry(entry));
}
@Test
- public void requireThatExceptionIsIncluded() {
+ void requireThatExceptionIsIncluded() {
Throwable t = new Throwable();
LogEntry entry = new MyEntry(0, 0, null).setException(t);
assertEquals("0.000000\t-\t-\t-\t-\tunknown\t\\n" + formatThrowable(t),
- SIMPLE_FORMATTER.formatEntry(entry));
+ SIMPLE_FORMATTER.formatEntry(entry));
}
@Test
- public void requireThatExceptionIsEscaped() {
+ void requireThatExceptionIsEscaped() {
Throwable t = new Throwable("\\\n\r\t");
LogEntry entry = new MyEntry(0, 0, null).setException(t);
assertEquals("0.000000\t-\t-\t-\t-\tunknown\t\\n" + formatThrowable(t),
- SIMPLE_FORMATTER.formatEntry(entry));
+ SIMPLE_FORMATTER.formatEntry(entry));
}
@Test
- public void requireThatExceptionIsSimplifiedForInfoEntries() {
+ void requireThatExceptionIsSimplifiedForInfoEntries() {
Throwable t = new Throwable("exception");
LogEntry entry = new MyEntry(0, LogService.LOG_INFO, "entry").setException(t);
assertEquals("0.000000\t-\t-\t-\t-\tinfo\tentry: exception",
- SIMPLE_FORMATTER.formatEntry(entry));
+ SIMPLE_FORMATTER.formatEntry(entry));
}
@Test
- public void requireThatSimplifiedExceptionIsEscaped() {
+ void requireThatSimplifiedExceptionIsEscaped() {
Throwable t = new Throwable("\\\n\r\t");
LogEntry entry = new MyEntry(0, LogService.LOG_INFO, "entry").setException(t);
assertEquals("0.000000\t-\t-\t-\t-\tinfo\tentry: \\\\\\n\\r\\t",
- SIMPLE_FORMATTER.formatEntry(entry));
+ SIMPLE_FORMATTER.formatEntry(entry));
}
@Test
- public void requireThatSimplifiedExceptionMessageIsOptional() {
+ void requireThatSimplifiedExceptionMessageIsOptional() {
Throwable t = new Throwable();
LogEntry entry = new MyEntry(0, LogService.LOG_INFO, "entry").setException(t);
assertEquals("0.000000\t-\t-\t-\t-\tinfo\tentry: java.lang.Throwable",
- SIMPLE_FORMATTER.formatEntry(entry));
+ SIMPLE_FORMATTER.formatEntry(entry));
}
private static String formatThrowable(Throwable t) {
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ConsoleLogListenerTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ConsoleLogListenerTestCase.java
index 5f7f7e733fa..0efefc21a2f 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ConsoleLogListenerTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ConsoleLogListenerTestCase.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.core;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;
import org.osgi.service.log.LogEntry;
@@ -11,7 +11,7 @@ import org.osgi.service.log.LogService;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author Vikas Panwar
@@ -22,7 +22,7 @@ public class ConsoleLogListenerTestCase {
private static final String PROCESS_ID = ConsoleLogListener.getProcessId();
@Test
- public void requireThatLogLevelParserKnowsOsgiLogLevels() {
+ void requireThatLogLevelParserKnowsOsgiLogLevels() {
assertEquals(LogService.LOG_ERROR, ConsoleLogListener.parseLogLevel("ERROR"));
assertEquals(LogService.LOG_WARNING, ConsoleLogListener.parseLogLevel("WARNING"));
assertEquals(LogService.LOG_INFO, ConsoleLogListener.parseLogLevel("INFO"));
@@ -30,31 +30,31 @@ public class ConsoleLogListenerTestCase {
}
@Test
- public void requireThatLogLevelParserKnowsOff() {
+ void requireThatLogLevelParserKnowsOff() {
assertEquals(Integer.MIN_VALUE, ConsoleLogListener.parseLogLevel("OFF"));
}
@Test
- public void requireThatLogLevelParserKnowsAll() {
+ void requireThatLogLevelParserKnowsAll() {
assertEquals(Integer.MAX_VALUE, ConsoleLogListener.parseLogLevel("ALL"));
}
@Test
- public void requireThatLogLevelParserKnowsIntegers() {
+ void requireThatLogLevelParserKnowsIntegers() {
for (int i = -69; i < 69; ++i) {
assertEquals(i, ConsoleLogListener.parseLogLevel(String.valueOf(i)));
}
}
@Test
- public void requireThatLogLevelParserErrorsReturnDefault() {
+ void requireThatLogLevelParserErrorsReturnDefault() {
assertEquals(ConsoleLogListener.DEFAULT_LOG_LEVEL, ConsoleLogListener.parseLogLevel(null));
assertEquals(ConsoleLogListener.DEFAULT_LOG_LEVEL, ConsoleLogListener.parseLogLevel(""));
assertEquals(ConsoleLogListener.DEFAULT_LOG_LEVEL, ConsoleLogListener.parseLogLevel("foo"));
}
@Test
- public void requireThatLogEntryWithLevelAboveThresholdIsNotOutput() {
+ void requireThatLogEntryWithLevelAboveThresholdIsNotOutput() {
ByteArrayOutputStream out = new ByteArrayOutputStream();
LogListener listener = new ConsoleLogListener(new PrintStream(out), null, "5");
for (int i = 0; i < 10; ++i) {
@@ -62,12 +62,12 @@ public class ConsoleLogListenerTestCase {
}
// TODO: Should use ConsoleLogFormatter.ABSENCE_REPLACEMENT instead of literal '-'. See ticket 7128315.
assertEquals("0.000000\t" + HOSTNAME + "\t" + PROCESS_ID + "\t-\t-\tunknown\tmessage\n" +
- "0.000000\t" + HOSTNAME + "\t" + PROCESS_ID + "\t-\t-\terror\tmessage\n" +
- "0.000000\t" + HOSTNAME + "\t" + PROCESS_ID + "\t-\t-\twarning\tmessage\n" +
- "0.000000\t" + HOSTNAME + "\t" + PROCESS_ID + "\t-\t-\tinfo\tmessage\n" +
- "0.000000\t" + HOSTNAME + "\t" + PROCESS_ID + "\t-\t-\tdebug\tmessage\n" +
- "0.000000\t" + HOSTNAME + "\t" + PROCESS_ID + "\t-\t-\tunknown\tmessage\n",
- out.toString());
+ "0.000000\t" + HOSTNAME + "\t" + PROCESS_ID + "\t-\t-\terror\tmessage\n" +
+ "0.000000\t" + HOSTNAME + "\t" + PROCESS_ID + "\t-\t-\twarning\tmessage\n" +
+ "0.000000\t" + HOSTNAME + "\t" + PROCESS_ID + "\t-\t-\tinfo\tmessage\n" +
+ "0.000000\t" + HOSTNAME + "\t" + PROCESS_ID + "\t-\t-\tdebug\tmessage\n" +
+ "0.000000\t" + HOSTNAME + "\t" + PROCESS_ID + "\t-\t-\tunknown\tmessage\n",
+ out.toString());
}
private static class MyEntry implements LogEntry {
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ConsoleLogManagerTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ConsoleLogManagerTestCase.java
index 4172d6d907a..fb5ee147bd8 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ConsoleLogManagerTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ConsoleLogManagerTestCase.java
@@ -2,17 +2,17 @@
package com.yahoo.jdisc.core;
import com.yahoo.jdisc.test.TestDriver;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.service.log.LogListener;
import org.osgi.service.log.LogReaderService;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-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.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
@@ -21,7 +21,7 @@ import static org.junit.Assert.fail;
public class ConsoleLogManagerTestCase {
@Test
- public void requireThatManagerCanNotBeInstalledTwice() throws BundleException {
+ void requireThatManagerCanNotBeInstalledTwice() throws BundleException {
FelixFramework felix = TestDriver.newOsgiFramework();
felix.start();
@@ -38,7 +38,7 @@ public class ConsoleLogManagerTestCase {
}
@Test
- public void requireThatManagerCanBeUninstalledTwice() throws BundleException {
+ void requireThatManagerCanBeUninstalledTwice() throws BundleException {
FelixFramework felix = TestDriver.newOsgiFramework();
felix.start();
@@ -52,7 +52,7 @@ public class ConsoleLogManagerTestCase {
}
@Test
- public void requireThatLogReaderServicesAreTracked() throws BundleException {
+ void requireThatLogReaderServicesAreTracked() throws BundleException {
FelixFramework felix = TestDriver.newOsgiFramework();
felix.start();
BundleContext ctx = felix.bundleContext();
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ContainerResourceTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ContainerResourceTestCase.java
index a1610c81331..ca78bea85b4 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ContainerResourceTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ContainerResourceTestCase.java
@@ -10,13 +10,13 @@ import com.yahoo.jdisc.handler.RequestHandler;
import com.yahoo.jdisc.handler.ResponseHandler;
import com.yahoo.jdisc.service.ServerProvider;
import com.yahoo.jdisc.test.TestDriver;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.net.URI;
import java.util.concurrent.atomic.AtomicInteger;
-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;
/**
@@ -25,7 +25,7 @@ import static org.junit.Assert.assertTrue;
public class ContainerResourceTestCase {
@Test
- public void requireThatBoundRequestHandlersAreRetainedOnActivate() {
+ void requireThatBoundRequestHandlersAreRetainedOnActivate() {
MyRequestHandler foo = new MyRequestHandler();
MyRequestHandler bar = new MyRequestHandler();
@@ -43,7 +43,7 @@ public class ContainerResourceTestCase {
}
@Test
- public void requireThatBoundRequestHandlersAreReleasedOnTermination() {
+ void requireThatBoundRequestHandlersAreReleasedOnTermination() {
MyRequestHandler handler = new MyRequestHandler();
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
@@ -62,7 +62,7 @@ public class ContainerResourceTestCase {
}
@Test
- public void requireThatServerProvidersAreRetainedOnActivate() {
+ void requireThatServerProvidersAreRetainedOnActivate() {
MyServerProvider foo = new MyServerProvider();
MyServerProvider bar = new MyServerProvider();
@@ -80,7 +80,7 @@ public class ContainerResourceTestCase {
}
@Test
- public void requireThatServerProvidersAreReleasedOnTermination() {
+ void requireThatServerProvidersAreReleasedOnTermination() {
MyServerProvider server = new MyServerProvider();
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ContainerShutdownTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ContainerShutdownTestCase.java
index cf247040c41..458ce3200fc 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ContainerShutdownTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ContainerShutdownTestCase.java
@@ -11,14 +11,14 @@ import com.yahoo.jdisc.handler.ContentChannel;
import com.yahoo.jdisc.handler.RequestHandler;
import com.yahoo.jdisc.handler.ResponseHandler;
import com.yahoo.jdisc.test.TestDriver;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.net.URI;
import java.nio.ByteBuffer;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author Simon Thoresen Hult
@@ -26,7 +26,7 @@ import static org.junit.Assert.fail;
public class ContainerShutdownTestCase {
@Test
- public void requireThatContainerBlocksTermination() {
+ void requireThatContainerBlocksTermination() {
Context ctx = Context.newInstance();
Container container = ctx.driver.newReference(URI.create("http://host/path"));
assertFalse(ctx.shutdown());
@@ -36,7 +36,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatNewRequestBlocksTermination() {
+ void requireThatNewRequestBlocksTermination() {
Context ctx = Context.newPendingRequest(MyRequestHandler.newInstance());
assertFalse(ctx.shutdown());
ctx.request.release();
@@ -45,7 +45,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatOpenRequestBlocksTermination() {
+ void requireThatOpenRequestBlocksTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newEagerCompletion();
Context ctx = Context.newPendingRequest(requestHandler);
ContentChannel requestContent = ctx.request.connect(MyResponseHandler.newEagerCompletion());
@@ -58,7 +58,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatResponsePendingBlocksTermination() {
+ void requireThatResponsePendingBlocksTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newEagerCompletion();
Context ctx = Context.newPendingRequest(requestHandler);
ctx.request.connect(MyResponseHandler.newEagerCompletion()).close(null);
@@ -70,7 +70,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatOpenResponseBlocksTermination() {
+ void requireThatOpenResponseBlocksTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newEagerCompletion();
Context ctx = Context.newPendingRequest(requestHandler);
ctx.request.connect(MyResponseHandler.newEagerCompletion()).close(null);
@@ -83,7 +83,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatRequestExceptionDoesNotBlockTermination() {
+ void requireThatRequestExceptionDoesNotBlockTermination() {
Context ctx = Context.newPendingRequest(MyRequestHandler.newRequestException());
try {
ctx.request.connect(MyResponseHandler.newEagerCompletion());
@@ -97,7 +97,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatRequestExceptionWithEagerHandleResponseBlocksTermination() {
+ void requireThatRequestExceptionWithEagerHandleResponseBlocksTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newRequestExceptionWithEagerHandleResponse();
Context ctx = Context.newPendingRequest(requestHandler);
try {
@@ -114,7 +114,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatRequestExceptionWithEagerCloseResponseDoesNotBlockTermination() {
+ void requireThatRequestExceptionWithEagerCloseResponseDoesNotBlockTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newRequestExceptionWithEagerCloseResponse();
Context ctx = Context.newPendingRequest(requestHandler);
try {
@@ -129,7 +129,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatNullRequestContentBlocksTermination() {
+ void requireThatNullRequestContentBlocksTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newNullContent();
Context ctx = Context.newPendingRequest(requestHandler);
ctx.request.connect(MyResponseHandler.newEagerCompletion()).close(null);
@@ -142,7 +142,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatNullRequestContentWithEagerHandleResponseBlocksTermination() {
+ void requireThatNullRequestContentWithEagerHandleResponseBlocksTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newNullContentWithEagerHandleResponse();
Context ctx = Context.newPendingRequest(requestHandler);
ctx.request.connect(MyResponseHandler.newEagerCompletion()).close(null);
@@ -154,7 +154,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatNullRequestContentWithEagerCloseResponseBlocksTermination() {
+ void requireThatNullRequestContentWithEagerCloseResponseBlocksTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newNulContentWithEagerCloseResponse();
Context ctx = Context.newPendingRequest(requestHandler);
ContentChannel requestContent = ctx.request.connect(MyResponseHandler.newEagerCompletion());
@@ -166,7 +166,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatRequestContentWriteFailedDoesNotBlockTermination() {
+ void requireThatRequestContentWriteFailedDoesNotBlockTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newEagerFail();
Context ctx = Context.newPendingRequest(requestHandler);
ContentChannel requestContent = ctx.request.connect(MyResponseHandler.newEagerCompletion());
@@ -179,7 +179,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatRequestContentWriteExceptionDoesNotBlockTermination() {
+ void requireThatRequestContentWriteExceptionDoesNotBlockTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newContentWriteExceptionWithEagerCompletion();
Context ctx = Context.newPendingRequest(requestHandler);
ContentChannel requestContent = ctx.request.connect(MyResponseHandler.newEagerCompletion());
@@ -197,7 +197,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatRequestContentWriteExceptionDoesNotForceTermination() {
+ void requireThatRequestContentWriteExceptionDoesNotForceTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newContentWriteExceptionWithEagerCompletion();
Context ctx = Context.newPendingRequest(requestHandler);
ContentChannel requestContent = ctx.request.connect(MyResponseHandler.newEagerCompletion());
@@ -216,7 +216,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatRequestContentWriteExceptionWithCompletionDoesNotBlockTermination() {
+ void requireThatRequestContentWriteExceptionWithCompletionDoesNotBlockTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newContentWriteExceptionWithEagerCompletion();
Context ctx = Context.newPendingRequest(requestHandler);
ContentChannel requestContent = ctx.request.connect(MyResponseHandler.newEagerCompletion());
@@ -234,7 +234,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatRequestContentCloseFailedDoesNotBlockTermination() {
+ void requireThatRequestContentCloseFailedDoesNotBlockTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newEagerFail();
Context ctx = Context.newPendingRequest(requestHandler);
ContentChannel requestContent = ctx.request.connect(MyResponseHandler.newEagerCompletion());
@@ -246,7 +246,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatRequestContentCloseExceptionDoesNotBlockTermination() {
+ void requireThatRequestContentCloseExceptionDoesNotBlockTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newContentCloseException();
Context ctx = Context.newPendingRequest(requestHandler);
ContentChannel requestContent = ctx.request.connect(MyResponseHandler.newEagerCompletion());
@@ -263,7 +263,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatRequestContentCloseExceptionWithCompletionDoesNotBlockTermination() {
+ void requireThatRequestContentCloseExceptionWithCompletionDoesNotBlockTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newContentCloseException();
Context ctx = Context.newPendingRequest(requestHandler);
ContentChannel requestContent = ctx.request.connect(MyResponseHandler.newEagerCompletion());
@@ -280,7 +280,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatRequestWriteCompletionBlocksTermination() {
+ void requireThatRequestWriteCompletionBlocksTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newEagerCloseResponse();
Context ctx = Context.newPendingRequest(requestHandler);
ContentChannel requestContent = ctx.request.connect(MyResponseHandler.newEagerCompletion());
@@ -295,7 +295,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatRequestWriteCompletionExceptionDoesNotBlockTermination() {
+ void requireThatRequestWriteCompletionExceptionDoesNotBlockTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newEagerCloseResponse();
Context ctx = Context.newPendingRequest(requestHandler);
ContentChannel requestContent = ctx.request.connect(MyResponseHandler.newEagerCompletion());
@@ -315,7 +315,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatRequestCloseCompletionBlocksTermination() {
+ void requireThatRequestCloseCompletionBlocksTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newEagerCloseResponse();
Context ctx = Context.newPendingRequest(requestHandler);
ContentChannel requestContent = ctx.request.connect(MyResponseHandler.newEagerCompletion());
@@ -328,7 +328,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatRequestCloseCompletionExceptionDoesNotBlockTermination() {
+ void requireThatRequestCloseCompletionExceptionDoesNotBlockTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newEagerCloseResponse();
Context ctx = Context.newPendingRequest(requestHandler);
ContentChannel requestContent = ctx.request.connect(MyResponseHandler.newEagerCompletion());
@@ -346,7 +346,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatNullResponseContentBlocksTermination() {
+ void requireThatNullResponseContentBlocksTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newEagerRespondWithEagerCompletion();
Context ctx = Context.newPendingRequest(requestHandler);
MyResponseHandler responseHandler = MyResponseHandler.newNullContent();
@@ -360,7 +360,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatResponseExceptionDoesNotBlockTermination() {
+ void requireThatResponseExceptionDoesNotBlockTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newEagerCompletion();
Context ctx = Context.newPendingRequest(requestHandler);
ctx.request.connect(MyResponseHandler.newResponseException()).close(null);
@@ -376,7 +376,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatResponseContentWriteFailedDoesNotBlockTermination() {
+ void requireThatResponseContentWriteFailedDoesNotBlockTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newEagerCompletion();
Context ctx = Context.newPendingRequest(requestHandler);
MyResponseHandler responseHandler = MyResponseHandler.newEagerFail();
@@ -390,7 +390,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatResponseContentCloseFailedDoesNotBlockTermination() {
+ void requireThatResponseContentCloseFailedDoesNotBlockTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newEagerCompletion();
Context ctx = Context.newPendingRequest(requestHandler);
MyResponseHandler responseHandler = MyResponseHandler.newEagerFail();
@@ -403,7 +403,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatResponseContentWriteExceptionDoesNotBlockTermination() {
+ void requireThatResponseContentWriteExceptionDoesNotBlockTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newEagerCompletion();
Context ctx = Context.newPendingRequest(requestHandler);
MyResponseHandler responseHandler = MyResponseHandler.newContentWriteException();
@@ -423,7 +423,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatResponseContentWriteExceptionDoesNotForceTermination() {
+ void requireThatResponseContentWriteExceptionDoesNotForceTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newEagerCompletion();
Context ctx = Context.newPendingRequest(requestHandler);
MyResponseHandler responseHandler = MyResponseHandler.newContentWriteException();
@@ -444,7 +444,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatResponseContentWriteExceptionWithCompletionDoesNotBlockTermination() {
+ void requireThatResponseContentWriteExceptionWithCompletionDoesNotBlockTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newEagerCompletion();
Context ctx = Context.newPendingRequest(requestHandler);
MyResponseHandler responseHandler = MyResponseHandler.newContentWriteException();
@@ -464,7 +464,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatResponseContentCloseExceptionDoesNotBlockTermination() {
+ void requireThatResponseContentCloseExceptionDoesNotBlockTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newEagerCompletion();
Context ctx = Context.newPendingRequest(requestHandler);
ctx.request.connect(MyResponseHandler.newContentCloseException()).close(null);
@@ -480,7 +480,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatResponseContentCloseExceptionWithCompletionDoesNotBlockTermination() {
+ void requireThatResponseContentCloseExceptionWithCompletionDoesNotBlockTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newEagerCompletion();
Context ctx = Context.newPendingRequest(requestHandler);
ctx.request.connect(MyResponseHandler.newContentCloseException()).close(null);
@@ -496,7 +496,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatResponseWriteCompletionBlocksTermination() {
+ void requireThatResponseWriteCompletionBlocksTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newEagerRespondWithEagerCompletion();
Context ctx = Context.newPendingRequest(requestHandler);
MyResponseHandler responseHandler = MyResponseHandler.newInstance();
@@ -513,7 +513,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatResponseWriteCompletionExceptionDoesNotBlockTermination() {
+ void requireThatResponseWriteCompletionExceptionDoesNotBlockTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newEagerRespondWithEagerCompletion();
Context ctx = Context.newPendingRequest(requestHandler);
MyResponseHandler responseHandler = MyResponseHandler.newInstance();
@@ -535,7 +535,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatResponseCloseCompletionBlocksTermination() {
+ void requireThatResponseCloseCompletionBlocksTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newEagerRespondWithEagerCompletion();
Context ctx = Context.newPendingRequest(requestHandler);
MyResponseHandler responseHandler = MyResponseHandler.newInstance();
@@ -550,7 +550,7 @@ public class ContainerShutdownTestCase {
}
@Test
- public void requireThatResponseCloseCompletionExceptionDoesNotBlockTermination() {
+ void requireThatResponseCloseCompletionExceptionDoesNotBlockTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newEagerRespondWithEagerCompletion();
Context ctx = Context.newPendingRequest(requestHandler);
MyResponseHandler responseHandler = MyResponseHandler.newInstance();
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ContainerSnapshotTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ContainerSnapshotTestCase.java
index dc1f3c7609e..2f93832b503 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ContainerSnapshotTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ContainerSnapshotTestCase.java
@@ -11,16 +11,16 @@ import com.yahoo.jdisc.handler.ContentChannel;
import com.yahoo.jdisc.handler.RequestHandler;
import com.yahoo.jdisc.handler.ResponseHandler;
import com.yahoo.jdisc.test.TestDriver;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.net.URI;
import java.nio.ByteBuffer;
-import static org.junit.Assert.assertEquals;
-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.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;
/**
@@ -29,7 +29,7 @@ import static org.junit.Assert.assertTrue;
public class ContainerSnapshotTestCase {
@Test
- public void requireThatServerHandlerCanBeResolved() {
+ void requireThatServerHandlerCanBeResolved() {
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
ContainerBuilder builder = driver.newContainerBuilder();
builder.serverBindings().bind("http://foo/*", MyRequestHandler.newInstance());
@@ -59,7 +59,7 @@ public class ContainerSnapshotTestCase {
}
@Test
- public void requireThatClientHandlerCanBeResolved() {
+ void requireThatClientHandlerCanBeResolved() {
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
ContainerBuilder builder = driver.newContainerBuilder();
builder.clientBindings().bind("http://foo/*", MyRequestHandler.newInstance());
@@ -89,7 +89,7 @@ public class ContainerSnapshotTestCase {
}
@Test
- public void requireThatClientBindingsAreUsed() {
+ void requireThatClientBindingsAreUsed() {
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
ContainerBuilder builder = driver.newContainerBuilder();
builder.clientBindings().bind("http://host/path", MyRequestHandler.newInstance());
@@ -101,7 +101,7 @@ public class ContainerSnapshotTestCase {
}
@Test
- public void requireThatBindingMatchIsSetByResolveHandler() {
+ void requireThatBindingMatchIsSetByResolveHandler() {
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
ContainerBuilder builder = driver.newContainerBuilder();
builder.serverBindings().bind("http://*/*", MyRequestHandler.newInstance());
@@ -121,7 +121,7 @@ public class ContainerSnapshotTestCase {
}
@Test
- public void requireThatNewRequestHasSameSnapshot() {
+ void requireThatNewRequestHasSameSnapshot() {
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
driver.activateContainer(driver.newContainerBuilder());
Request foo = new Request(driver, URI.create("http://host/foo"));
@@ -133,7 +133,7 @@ public class ContainerSnapshotTestCase {
}
@Test
- public void requireThatActiveInjectorIsUsed() {
+ void requireThatActiveInjectorIsUsed() {
final Object obj = new Object();
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi(new AbstractModule() {
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ContainerTerminationTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ContainerTerminationTestCase.java
index de22a49895f..110ea9745b6 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ContainerTerminationTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ContainerTerminationTestCase.java
@@ -4,11 +4,11 @@ package com.yahoo.jdisc.core;
import com.yahoo.jdisc.application.ContainerBuilder;
import com.yahoo.jdisc.application.DeactivatedContainer;
import com.yahoo.jdisc.test.TestDriver;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertFalse;
-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.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author Simon Thoresen Hult
@@ -16,14 +16,14 @@ import static org.junit.Assert.assertTrue;
public class ContainerTerminationTestCase {
@Test
- public void requireThatAccessorsWork() {
+ void requireThatAccessorsWork() {
Object obj = new Object();
ContainerTermination termination = new ContainerTermination(obj);
assertSame(obj, termination.appContext());
}
@Test
- public void requireThatAppContextIsFromBuilder() {
+ void requireThatAppContextIsFromBuilder() {
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
ContainerBuilder builder = driver.newContainerBuilder();
Object obj = new Object();
@@ -35,7 +35,7 @@ public class ContainerTerminationTestCase {
}
@Test
- public void requireThatEarlyTerminationIsNotified() {
+ void requireThatEarlyTerminationIsNotified() {
ContainerTermination termination = new ContainerTermination(null);
termination.run();
MyTask task = new MyTask();
@@ -44,7 +44,7 @@ public class ContainerTerminationTestCase {
}
@Test
- public void requireThatLaterTerminationIsNotified() {
+ void requireThatLaterTerminationIsNotified() {
ContainerTermination termination = new ContainerTermination(null);
MyTask task = new MyTask();
termination.notifyTermination(task);
@@ -54,7 +54,7 @@ public class ContainerTerminationTestCase {
}
@Test
- public void requireThatNotifyCanOnlyBeCalledOnce() {
+ void requireThatNotifyCanOnlyBeCalledOnce() {
ContainerTermination termination = new ContainerTermination(null);
termination.notifyTermination(new MyTask());
try {
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ContainerWatchdogTest.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ContainerWatchdogTest.java
index e72b01d8b8f..d669961e728 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ContainerWatchdogTest.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ContainerWatchdogTest.java
@@ -4,14 +4,14 @@ package com.yahoo.jdisc.core;
import com.yahoo.jdisc.Metric;
import com.yahoo.jdisc.test.TestDriver;
import com.yahoo.test.ManualClock;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.time.Duration;
import java.time.Instant;
import java.util.Map;
import java.util.concurrent.ScheduledExecutorService;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
/**
@@ -20,7 +20,7 @@ import static org.mockito.Mockito.mock;
public class ContainerWatchdogTest {
@Test
- public void watchdog_counts_stale_container() {
+ void watchdog_counts_stale_container() {
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
ManualClock clock = new ManualClock(Instant.EPOCH);
DummyMetric metric = new DummyMetric();
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/DefaultBindingSelectorTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/DefaultBindingSelectorTestCase.java
index 66c92aa138a..50db994c4d3 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/DefaultBindingSelectorTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/DefaultBindingSelectorTestCase.java
@@ -4,12 +4,12 @@ package com.yahoo.jdisc.core;
import com.google.inject.Guice;
import com.yahoo.jdisc.application.BindingSet;
import com.yahoo.jdisc.application.BindingSetSelector;
-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.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
@@ -18,13 +18,13 @@ import static org.junit.Assert.assertTrue;
public class DefaultBindingSelectorTestCase {
@Test
- public void requireThatClassIsInjectedByDefault() {
+ void requireThatClassIsInjectedByDefault() {
BindingSetSelector selector = Guice.createInjector().getInstance(BindingSetSelector.class);
assertTrue(selector instanceof DefaultBindingSelector);
}
@Test
- public void requireThatDefaultSetIsAlwaysSelected() {
+ void requireThatDefaultSetIsAlwaysSelected() {
DefaultBindingSelector selector = new DefaultBindingSelector();
assertEquals(BindingSet.DEFAULT, selector.select(null));
for (int i = 0; i < 69; ++i) {
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ExportPackagesIT.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ExportPackagesIT.java
index 1cd8db67476..e9aba0893f9 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ExportPackagesIT.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ExportPackagesIT.java
@@ -1,12 +1,12 @@
package com.yahoo.jdisc.core;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
+import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
@@ -15,8 +15,8 @@ import java.util.TreeSet;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* Integration tests for {@link ExportPackages}.
@@ -49,22 +49,22 @@ public class ExportPackagesIT {
"javax.activation.jar"
).map(f -> JAR_PATH + f).toList();
- @ClassRule
- public static TemporaryFolder tempFolder = new TemporaryFolder();
+ @TempDir
+ public static File tempFolder;
@Test
- public void exported_packages_are_not_changed_unintentionally() throws Exception {
+ void exported_packages_are_not_changed_unintentionally() throws Exception {
Properties actualProperties = getPropertiesFromFile(createPropertiesFile());
String actualValue = actualProperties.getProperty(ExportPackages.EXPORT_PACKAGES);
- assertNotNull("Missing exportPackages property in file.", actualValue);
+ assertNotNull(actualValue, "Missing exportPackages property in file.");
Properties expectedProperties = getPropertiesFromFile(expectedExportPackages);
String expectedValue = expectedProperties.getProperty(ExportPackages.EXPORT_PACKAGES);
- assertNotNull("Missing exportPackages property in file.", expectedValue);
+ assertNotNull(expectedValue, "Missing exportPackages property in file.");
Set<String> actualPackages = getPackages(actualValue);
Set<String> expectedPackages = getPackages(expectedValue);
- if (! actualPackages.equals(expectedPackages)) {
+ if (!actualPackages.equals(expectedPackages)) {
StringBuilder message = getDiff(actualPackages, expectedPackages);
message.append("\n\nIf this test fails due to an intentional change in exported packages, run the following command:\n")
.append("$ cp jdisc_core/target/classes/exportPackages.properties jdisc_core/src/test/resources/")
@@ -116,7 +116,7 @@ public class ExportPackagesIT {
}
private static File createPropertiesFile() throws IOException {
- File file = tempFolder.newFile(ExportPackages.PROPERTIES_FILE);
+ File file = Paths.get(tempFolder.toString(), ExportPackages.PROPERTIES_FILE).toFile();
String[] args = Stream.concat(Stream.of(file.getAbsolutePath()),
RE_EXPORTED_BUNDLES.stream()).toArray(String[]::new);
ExportPackages.main(args);
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/FelixFrameworkTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/FelixFrameworkTestCase.java
index fb663afa23f..d1cb59dbc30 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/FelixFrameworkTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/FelixFrameworkTestCase.java
@@ -2,10 +2,10 @@
package com.yahoo.jdisc.core;
import com.yahoo.jdisc.test.TestDriver;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.osgi.framework.BundleException;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.fail;
/**
@@ -14,20 +14,20 @@ import static org.junit.Assert.fail;
public class FelixFrameworkTestCase {
@Test
- public void requireThatLifecycleWorks() throws BundleException {
+ void requireThatLifecycleWorks() throws BundleException {
FelixFramework felix = TestDriver.newOsgiFramework();
felix.start();
felix.stop();
}
@Test
- public void requireThatStopWithoutStartDoesNotThrowException() throws BundleException {
+ void requireThatStopWithoutStartDoesNotThrowException() throws BundleException {
FelixFramework felix = TestDriver.newOsgiFramework();
felix.stop();
}
@Test
- public void requireThatInstallCanThrowException() throws BundleException {
+ void requireThatInstallCanThrowException() throws BundleException {
FelixFramework felix = TestDriver.newOsgiFramework();
felix.start();
try {
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/FelixParamsTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/FelixParamsTestCase.java
index 490470b4fdf..6c488f8b735 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/FelixParamsTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/FelixParamsTestCase.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.core;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.osgi.framework.Constants;
import java.util.Arrays;
@@ -9,9 +9,9 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author Simon Thoresen Hult
@@ -19,7 +19,7 @@ import static org.junit.Assert.assertTrue;
public class FelixParamsTestCase {
@Test
- public void requireThatAccessorsWork() {
+ void requireThatAccessorsWork() {
FelixParams params = new FelixParams();
params.setCachePath("foo");
assertEquals("foo", params.getCachePath());
@@ -28,7 +28,7 @@ public class FelixParamsTestCase {
}
@Test
- public void requireThatSystemPackagesAreNotReplaced() {
+ void requireThatSystemPackagesAreNotReplaced() {
String systemPackages = ExportPackages.getSystemPackages();
FelixParams params = new FelixParams(systemPackages);
@@ -46,7 +46,7 @@ public class FelixParamsTestCase {
}
@Test
- public void requireThatExportsAreIncludedInConfig() {
+ void requireThatExportsAreIncludedInConfig() {
FelixParams params = new FelixParams();
Map<String, String> config = params.toConfig();
assertNotNull(config);
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogHandlerTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogHandlerTestCase.java
index 7c07623814e..626cae67c41 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogHandlerTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogHandlerTestCase.java
@@ -1,12 +1,11 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.core;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.osgi.framework.ServiceReference;
import org.osgi.service.log.LogService;
import java.time.Instant;
-import java.util.Arrays;
import java.util.Enumeration;
import java.util.ResourceBundle;
import java.util.logging.Handler;
@@ -14,11 +13,11 @@ import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
-import static org.junit.Assert.assertEquals;
-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.assertArrayEquals;
+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.assertSame;
/**
* @author Simon Thoresen Hult
@@ -26,7 +25,7 @@ import static org.junit.Assert.assertTrue;
public class OsgiLogHandlerTestCase {
@Test
- public void requireThatLogRecordsArePublishedToLogService() {
+ void requireThatLogRecordsArePublishedToLogService() {
MyLogService logService = new MyLogService();
Logger log = newLogger(logService);
@@ -43,7 +42,7 @@ public class OsgiLogHandlerTestCase {
}
@Test
- public void requireThatStadardLogLevelsAreConverted() {
+ void requireThatStadardLogLevelsAreConverted() {
assertLogLevel(LogService.LOG_ERROR, Level.SEVERE);
assertLogLevel(LogService.LOG_WARNING, Level.WARNING);
assertLogLevel(LogService.LOG_INFO, Level.INFO);
@@ -54,7 +53,7 @@ public class OsgiLogHandlerTestCase {
}
@Test
- public void requireThatCustomLogLevelsAreConverted() {
+ void requireThatCustomLogLevelsAreConverted() {
for (int i = Level.ALL.intValue() - 69; i < Level.OFF.intValue() + 69; ++i) {
int expectedLevel;
if (i >= Level.SEVERE.intValue()) {
@@ -71,7 +70,7 @@ public class OsgiLogHandlerTestCase {
}
@Test
- public void requireThatJdk14PropertiesAreAvailableThroughServiceReference() {
+ void requireThatJdk14PropertiesAreAvailableThroughServiceReference() {
MyLogService logService = new MyLogService();
Logger log = newLogger(logService);
@@ -93,19 +92,19 @@ public class OsgiLogHandlerTestCase {
ServiceReference<?> ref = logService.lastServiceReference;
assertNotNull(ref);
- assertTrue(Arrays.equals(new String[] { "LEVEL",
- "LOGGER_NAME",
- "MESSAGE",
- "MILLIS",
- "PARAMETERS",
- "RESOURCE_BUNDLE",
- "RESOURCE_BUNDLE_NAME",
- "SEQUENCE_NUMBER",
- "SOURCE_CLASS_NAME",
- "SOURCE_METHOD_NAME",
- "THREAD_ID",
- "THROWN" },
- ref.getPropertyKeys()));
+ assertArrayEquals(new String[]{"LEVEL",
+ "LOGGER_NAME",
+ "MESSAGE",
+ "MILLIS",
+ "PARAMETERS",
+ "RESOURCE_BUNDLE",
+ "RESOURCE_BUNDLE_NAME",
+ "SEQUENCE_NUMBER",
+ "SOURCE_CLASS_NAME",
+ "SOURCE_METHOD_NAME",
+ "THREAD_ID",
+ "THROWN"},
+ ref.getPropertyKeys());
assertEquals(Level.INFO, ref.getProperty("LEVEL"));
assertEquals("loggerName", ref.getProperty("LOGGER_NAME"));
assertEquals("message", ref.getProperty("MESSAGE"));
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogManagerTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogManagerTestCase.java
index be4c0ada514..7b5af97ca13 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogManagerTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogManagerTestCase.java
@@ -2,7 +2,7 @@
package com.yahoo.jdisc.core;
import com.yahoo.jdisc.test.TestDriver;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
@@ -13,9 +13,9 @@ import org.osgi.service.log.LogService;
import java.util.logging.Level;
import java.util.logging.Logger;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
/**
@@ -24,7 +24,7 @@ import static org.junit.Assert.assertSame;
public class OsgiLogManagerTestCase {
@Test
- public void requireThatAllLogMethodsAreImplemented() throws BundleException {
+ void requireThatAllLogMethodsAreImplemented() throws BundleException {
FelixFramework felix = TestDriver.newOsgiFramework();
felix.start();
@@ -55,7 +55,7 @@ public class OsgiLogManagerTestCase {
}
@Test
- public void requireThatLogManagerWritesToAllRegisteredLogServices() throws BundleException {
+ void requireThatLogManagerWritesToAllRegisteredLogServices() throws BundleException {
FelixFramework felix = TestDriver.newOsgiFramework();
felix.start();
@@ -122,7 +122,7 @@ public class OsgiLogManagerTestCase {
}
@Test
- public void requireThatRootLoggerModificationCanBeDisabled() throws BundleException {
+ void requireThatRootLoggerModificationCanBeDisabled() throws BundleException {
Logger logger = Logger.getLogger("");
logger.setLevel(Level.WARNING);
@@ -134,7 +134,7 @@ public class OsgiLogManagerTestCase {
}
@Test
- public void requireThatRootLoggerLevelIsModifiedIfNoLoggerConfigIsGiven() {
+ void requireThatRootLoggerLevelIsModifiedIfNoLoggerConfigIsGiven() {
Logger logger = Logger.getLogger("");
logger.setLevel(Level.WARNING);
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogServiceTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogServiceTestCase.java
index 15377d7ae37..bfdaad9450f 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogServiceTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogServiceTestCase.java
@@ -3,15 +3,15 @@ package com.yahoo.jdisc.core;
import com.yahoo.jdisc.application.OsgiFramework;
import com.yahoo.jdisc.test.TestDriver;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.service.log.LogReaderService;
import org.osgi.service.log.LogService;
import org.osgi.util.tracker.ServiceTracker;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
/**
@@ -20,12 +20,12 @@ import static org.junit.Assert.fail;
public class OsgiLogServiceTestCase {
@Test
- public void requireThatLogServiceIsRegistered() throws BundleException, InterruptedException {
+ void requireThatLogServiceIsRegistered() throws BundleException, InterruptedException {
OsgiFramework osgi = TestDriver.newOsgiFramework();
osgi.start();
- ServiceTracker<?,?> logs = newTracker(osgi, LogService.class);
- ServiceTracker<?,?> logReaders = newTracker(osgi, LogReaderService.class);
+ ServiceTracker<?, ?> logs = newTracker(osgi, LogService.class);
+ ServiceTracker<?, ?> logReaders = newTracker(osgi, LogReaderService.class);
assertEquals(1, logs.getTrackingCount());
assertEquals(1, logReaders.getTrackingCount());
@@ -38,7 +38,7 @@ public class OsgiLogServiceTestCase {
}
@Test
- public void requireThatLogServiceCanNotBeStartedTwice() throws BundleException {
+ void requireThatLogServiceCanNotBeStartedTwice() throws BundleException {
OsgiFramework osgi = TestDriver.newOsgiFramework();
osgi.start();
@@ -57,7 +57,7 @@ public class OsgiLogServiceTestCase {
}
@Test
- public void requireThatLogServiceCanNotBeStoppedTwice() throws BundleException {
+ void requireThatLogServiceCanNotBeStoppedTwice() throws BundleException {
OsgiFramework osgi = TestDriver.newOsgiFramework();
osgi.start();
@@ -77,7 +77,7 @@ public class OsgiLogServiceTestCase {
}
@Test
- public void requireThatUnstartedLogServiceCanNotBeStopped() throws BundleException {
+ void requireThatUnstartedLogServiceCanNotBeStopped() throws BundleException {
try {
new OsgiLogService().stop();
fail();
@@ -87,7 +87,7 @@ public class OsgiLogServiceTestCase {
}
@Test
- public void requireThatLogServiceCanNotStartWithoutBundleContext() throws BundleException {
+ void requireThatLogServiceCanNotStartWithoutBundleContext() throws BundleException {
try {
new OsgiLogService().start(null);
fail();
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ScheduledQueueTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ScheduledQueueTestCase.java
index 163111c641d..cd963caa8d2 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ScheduledQueueTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ScheduledQueueTestCase.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.core;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.LinkedList;
@@ -11,9 +11,9 @@ import java.util.Queue;
import static com.yahoo.jdisc.core.ScheduledQueue.MILLIS_PER_SLOT;
import static com.yahoo.jdisc.core.ScheduledQueue.NUM_SLOTS;
import static com.yahoo.jdisc.core.ScheduledQueue.NUM_SLOTS_UNDILATED;
-import static org.junit.Assert.assertEquals;
-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.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author Simon Thoresen Hult
@@ -21,21 +21,21 @@ import static org.junit.Assert.fail;
public class ScheduledQueueTestCase {
@Test
- public void requireThatSlotMaskPreventsOverflow() {
+ void requireThatSlotMaskPreventsOverflow() {
for (int slot = 0; slot < NUM_SLOTS * 2; ++slot) {
assertTrue((slot & ScheduledQueue.SLOT_MASK) < NUM_SLOTS);
}
}
@Test
- public void requireThatIterShiftDiscardsSlotBits() {
+ void requireThatIterShiftDiscardsSlotBits() {
for (int slot = 0; slot < NUM_SLOTS * 2; ++slot) {
assertEquals(slot / NUM_SLOTS, slot >> ScheduledQueue.ITER_SHIFT);
}
}
@Test
- public void requireThatNewEntryDoesNotAcceptNull() {
+ void requireThatNewEntryDoesNotAcceptNull() {
ScheduledQueue queue = new ScheduledQueue(0);
try {
queue.newEntry(null);
@@ -46,7 +46,7 @@ public class ScheduledQueueTestCase {
}
@Test
- public void requireThatEntriesCanBeScheduled() {
+ void requireThatEntriesCanBeScheduled() {
ScheduledQueue queue = new ScheduledQueue(0);
Object foo = new Object();
ScheduledQueue.Entry entry = queue.newEntry(foo);
@@ -57,7 +57,7 @@ public class ScheduledQueueTestCase {
}
@Test
- public void requireThatEntriesCanBeRescheduled() {
+ void requireThatEntriesCanBeRescheduled() {
ScheduledQueue queue = new ScheduledQueue(0);
Object foo = new Object();
ScheduledQueue.Entry entry = queue.newEntry(foo);
@@ -69,7 +69,7 @@ public class ScheduledQueueTestCase {
}
@Test
- public void requireThatEntriesCanBeUnscheduled() {
+ void requireThatEntriesCanBeUnscheduled() {
ScheduledQueue queue = new ScheduledQueue(0);
Object foo = new Object();
ScheduledQueue.Entry entry = queue.newEntry(foo);
@@ -80,7 +80,7 @@ public class ScheduledQueueTestCase {
}
@Test
- public void requireThatDrainToOnlyDrainsExpiredEntries() {
+ void requireThatDrainToOnlyDrainsExpiredEntries() {
ScheduledQueue queue = new ScheduledQueue(0);
Object foo = scheduleAt(queue, 100);
Object bar = scheduleAt(queue, 300);
@@ -93,7 +93,7 @@ public class ScheduledQueueTestCase {
}
@Test
- public void requireThatEntriesDoNotExpireMoreThanOnce() {
+ void requireThatEntriesDoNotExpireMoreThanOnce() {
ScheduledQueue queue = new ScheduledQueue(0);
Object foo = scheduleAt(queue, NUM_SLOTS * MILLIS_PER_SLOT + 50);
@@ -108,7 +108,7 @@ public class ScheduledQueueTestCase {
}
@Test
- public void requireThatNegativeScheduleTranslatesToNow() {
+ void requireThatNegativeScheduleTranslatesToNow() {
ScheduledQueue queue = new ScheduledQueue(0);
Object foo = scheduleAt(queue, -100);
@@ -116,7 +116,7 @@ public class ScheduledQueueTestCase {
}
@Test
- public void requireThatDrainToPerformsTimeDilationWhenOverloaded() {
+ void requireThatDrainToPerformsTimeDilationWhenOverloaded() {
ScheduledQueue queue = new ScheduledQueue(0);
List<Object> payloads = new LinkedList<>();
for (int i = 1; i <= NUM_SLOTS_UNDILATED + 1; ++i) {
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/SystemTimerTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/SystemTimerTestCase.java
index 52e25877402..dc6d3b30cb2 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/SystemTimerTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/SystemTimerTestCase.java
@@ -3,9 +3,9 @@ package com.yahoo.jdisc.core;
import com.google.inject.Guice;
import com.yahoo.jdisc.Timer;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
@@ -14,13 +14,13 @@ import static org.junit.Assert.assertTrue;
public class SystemTimerTestCase {
@Test
- public void requireThatClassIsInjectedByDefault() {
+ void requireThatClassIsInjectedByDefault() {
Timer timer = Guice.createInjector().getInstance(Timer.class);
assertTrue(timer instanceof SystemTimer);
}
@Test
- public void requireThatSystemTimerIsSane() {
+ void requireThatSystemTimerIsSane() {
long before = System.currentTimeMillis();
long millis = new SystemTimer().currentTimeMillis();
long after = System.currentTimeMillis();
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/TimeoutManagerImplTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/TimeoutManagerImplTestCase.java
index 75ebad12158..0308abebd8a 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/TimeoutManagerImplTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/TimeoutManagerImplTestCase.java
@@ -19,7 +19,7 @@ import com.yahoo.jdisc.handler.ResponseHandler;
import com.yahoo.jdisc.service.CurrentContainer;
import com.yahoo.jdisc.test.NonWorkingRequest;
import com.yahoo.jdisc.test.TestDriver;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.net.URI;
import java.nio.ByteBuffer;
@@ -28,13 +28,13 @@ import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
-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.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.assertNull;
+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
@@ -44,35 +44,35 @@ public class TimeoutManagerImplTestCase {
private static final String REQUEST_URI = "http://host/path";
@Test
- public void requireThatDefaultIsNoTimeout() {
+ void requireThatDefaultIsNoTimeout() {
Context ctx = new Context(MyRequestHandler.newEagerResponse());
assertNull(ctx.dispatchRequest(null, MyResponseHandler.newInstance()));
assertTrue(ctx.close());
}
@Test
- public void requireThatTimeoutCanBeSetByServerProvider() {
+ void requireThatTimeoutCanBeSetByServerProvider() {
Context ctx = new Context(MyRequestHandler.newEagerResponse());
assertEquals(Long.valueOf(69), ctx.dispatchRequest(69L, MyResponseHandler.newInstance()));
assertTrue(ctx.close());
}
@Test
- public void requireThatTimeoutCanBeSetByRequestHandler() {
+ void requireThatTimeoutCanBeSetByRequestHandler() {
Context ctx = new Context(MyRequestHandler.newTimeoutWithEagerResponse(69));
assertEquals(Long.valueOf(69), ctx.dispatchRequest(null, MyResponseHandler.newInstance()));
assertTrue(ctx.close());
}
@Test
- public void requireThatTimeoutRequestHandlerTimeoutHasPrecedence() {
+ void requireThatTimeoutRequestHandlerTimeoutHasPrecedence() {
Context ctx = new Context(MyRequestHandler.newTimeoutWithEagerResponse(6));
assertEquals(Long.valueOf(6), ctx.dispatchRequest(9L, MyResponseHandler.newInstance()));
assertTrue(ctx.close());
}
@Test
- public void requireThatResponseCancelsTimeout() throws InterruptedException {
+ void requireThatResponseCancelsTimeout() throws InterruptedException {
Context ctx = new Context(MyRequestHandler.newEagerResponse());
assertEquals(Response.Status.OK, ctx.awaitResponse(69L, MyResponseHandler.newInstance()));
assertEquals(Response.Status.OK, ctx.awaitResponse(69L, MyResponseHandler.newInstance()));
@@ -80,7 +80,7 @@ public class TimeoutManagerImplTestCase {
}
@Test
- public void requireThatNullRequestContentCanTimeout() throws InterruptedException {
+ void requireThatNullRequestContentCanTimeout() throws InterruptedException {
Context ctx = new Context(MyRequestHandler.newNullContent());
assertEquals(Response.Status.GATEWAY_TIMEOUT, ctx.awaitResponse(69L, MyResponseHandler.newInstance()));
assertEquals(Response.Status.GATEWAY_TIMEOUT, ctx.awaitResponse(69L, MyResponseHandler.newInstance()));
@@ -88,7 +88,7 @@ public class TimeoutManagerImplTestCase {
}
@Test
- public void requireThatTimeoutWorksAfterRequestDenied() throws InterruptedException {
+ void requireThatTimeoutWorksAfterRequestDenied() throws InterruptedException {
Context ctx = new Context(MyRequestHandler.newFirstRequestDenied());
try {
ctx.dispatchRequest(null, MyResponseHandler.newInstance());
@@ -101,7 +101,7 @@ public class TimeoutManagerImplTestCase {
}
@Test
- public void requireThatTimeoutWorksAfterResponseDenied() throws InterruptedException {
+ void requireThatTimeoutWorksAfterResponseDenied() throws InterruptedException {
Context ctx = new Context(MyRequestHandler.newInstance());
assertEquals(Response.Status.GATEWAY_TIMEOUT, ctx.awaitResponse(69L, MyResponseHandler.newResponseDenied()));
assertEquals(Response.Status.GATEWAY_TIMEOUT, ctx.awaitResponse(69L, MyResponseHandler.newInstance()));
@@ -109,7 +109,7 @@ public class TimeoutManagerImplTestCase {
}
@Test
- public void requireThatTimeoutWorksAfterResponseThrowsException() throws InterruptedException {
+ void requireThatTimeoutWorksAfterResponseThrowsException() throws InterruptedException {
Context ctx = new Context(MyRequestHandler.newInstance());
assertEquals(Response.Status.GATEWAY_TIMEOUT, ctx.awaitResponse(69L, MyResponseHandler.newThrowException()));
assertEquals(Response.Status.GATEWAY_TIMEOUT, ctx.awaitResponse(69L, MyResponseHandler.newInstance()));
@@ -117,7 +117,7 @@ public class TimeoutManagerImplTestCase {
}
@Test
- public void requireThatTimeoutWorksAfterResponseInterruptsThread() throws InterruptedException {
+ void requireThatTimeoutWorksAfterResponseInterruptsThread() throws InterruptedException {
Context ctx = new Context(MyRequestHandler.newInstance());
assertEquals(Response.Status.GATEWAY_TIMEOUT, ctx.awaitResponse(69L, MyResponseHandler.newInterruptThread()));
assertEquals(Response.Status.GATEWAY_TIMEOUT, ctx.awaitResponse(69L, MyResponseHandler.newInstance()));
@@ -125,7 +125,7 @@ public class TimeoutManagerImplTestCase {
}
@Test
- public void requireThatTimeoutOccursInOrder() throws InterruptedException {
+ void requireThatTimeoutOccursInOrder() throws InterruptedException {
Context ctx = new Context(MyRequestHandler.newInstance());
MyResponseHandler foo = MyResponseHandler.newInstance();
ctx.dispatchRequest(300L, foo);
@@ -152,7 +152,7 @@ public class TimeoutManagerImplTestCase {
}
@Test
- public void requireThatResponseHandlerIsWellBehavedAfterTimeout() throws InterruptedException {
+ void requireThatResponseHandlerIsWellBehavedAfterTimeout() throws InterruptedException {
Context ctx = new Context(MyRequestHandler.newInstance());
assertEquals(Response.Status.GATEWAY_TIMEOUT, ctx.awaitResponse(69L, MyResponseHandler.newInstance()));
@@ -172,11 +172,11 @@ public class TimeoutManagerImplTestCase {
}
@Test
- public void requireThatManagedHandlerForwardsAllCalls() throws InterruptedException {
+ void requireThatManagedHandlerForwardsAllCalls() throws InterruptedException {
Request request = NonWorkingRequest.newInstance(REQUEST_URI);
MyRequestHandler requestHandler = MyRequestHandler.newInstance();
TimeoutManagerImpl timeoutManager = new TimeoutManagerImpl(Executors.defaultThreadFactory(),
- new SystemTimer());
+ new SystemTimer());
RequestHandler managedHandler = timeoutManager.manageHandler(requestHandler);
MyResponseHandler responseHandler = MyResponseHandler.newInstance();
@@ -219,7 +219,7 @@ public class TimeoutManagerImplTestCase {
}
@Test
- public void requireThatTimeoutOccursAtExpectedTime() throws InterruptedException {
+ void requireThatTimeoutOccursAtExpectedTime() throws InterruptedException {
final Context ctx = new Context(MyRequestHandler.newInstance());
final MyResponseHandler responseHandler = MyResponseHandler.newInstance();
@@ -251,7 +251,7 @@ public class TimeoutManagerImplTestCase {
}
@Test
- public void requireThatQueueEntryIsRemovedWhenResponseHandlerIsCalledBeforeTimeout() {
+ void requireThatQueueEntryIsRemovedWhenResponseHandlerIsCalledBeforeTimeout() {
Context ctx = new Context(MyRequestHandler.newInstance());
ctx.dispatchRequest(69L, MyResponseHandler.newInstance());
assertTrue(ctx.awaitQueueSize(1, 600, TimeUnit.SECONDS));
@@ -261,7 +261,7 @@ public class TimeoutManagerImplTestCase {
}
@Test
- public void requireThatNoEntryIsMadeIfTimeoutIsNull() {
+ void requireThatNoEntryIsMadeIfTimeoutIsNull() {
Context ctx = new Context(MyRequestHandler.newInstance());
ctx.dispatchRequest(null, MyResponseHandler.newInstance());
assertFalse(ctx.awaitQueueSize(1, 100, TimeUnit.MILLISECONDS));
@@ -271,7 +271,7 @@ public class TimeoutManagerImplTestCase {
}
@Test
- public void requireThatNoEntryIsMadeIfHandleRequestCallsHandleResponse() {
+ void requireThatNoEntryIsMadeIfHandleRequestCallsHandleResponse() {
Context ctx = new Context(MyRequestHandler.newEagerResponse());
ctx.dispatchRequest(69L, MyResponseHandler.newInstance());
assertFalse(ctx.awaitQueueSize(1, 100, TimeUnit.MILLISECONDS));
@@ -280,7 +280,7 @@ public class TimeoutManagerImplTestCase {
}
@Test
- public void requireThatNoEntryIsMadeIfTimeoutHandlerHasBeenSet() {
+ void requireThatNoEntryIsMadeIfTimeoutHandlerHasBeenSet() {
final Context ctx = new Context(MyRequestHandler.newInstance());
new RequestDispatch() {