diff --git a/resteasy-rxjava2/pom.xml b/resteasy-rxjava2/pom.xml index 42b355cc7c2..5126b41abf9 100644 --- a/resteasy-rxjava2/pom.xml +++ b/resteasy-rxjava2/pom.xml @@ -50,8 +50,8 @@ - junit - junit + org.junit.jupiter + junit-jupiter-api test diff --git a/resteasy-rxjava2/src/test/java/org/jboss/resteasy/rxjava2/RxTest.java b/resteasy-rxjava2/src/test/java/org/jboss/resteasy/rxjava2/RxTest.java index 9031e1a6a3b..795abf68464 100644 --- a/resteasy-rxjava2/src/test/java/org/jboss/resteasy/rxjava2/RxTest.java +++ b/resteasy-rxjava2/src/test/java/org/jboss/resteasy/rxjava2/RxTest.java @@ -1,8 +1,6 @@ package org.jboss.resteasy.rxjava2; import static org.jboss.resteasy.test.TestPortProvider.generateURL; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; import java.util.Set; import java.util.TreeSet; @@ -19,12 +17,12 @@ import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.plugins.server.netty.NettyJaxrsServer; import org.jboss.resteasy.test.TestPortProvider; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import io.reactivex.Flowable; import io.reactivex.Observable; @@ -37,7 +35,7 @@ public class RxTest { private static AtomicReference value = new AtomicReference(); private static final Logger LOG = Logger.getLogger(NettyJaxrsServer.class); - @BeforeClass + @BeforeAll public static void beforeClass() throws Exception { server = new NettyJaxrsServer(); server.setPort(TestPortProvider.getPort()); @@ -49,7 +47,7 @@ public static void beforeClass() throws Exception { server.start(); } - @AfterClass + @AfterAll public static void afterClass() throws Exception { server.stop(); server = null; @@ -57,7 +55,7 @@ public static void afterClass() throws Exception { private ResteasyClient client; - @Before + @BeforeEach public void before() { client = ((ResteasyClientBuilder) ClientBuilder.newBuilder()) .readTimeout(5, TimeUnit.SECONDS) @@ -68,7 +66,7 @@ public void before() { latch = new CountDownLatch(1); } - @After + @AfterEach public void after() { client.close(); } @@ -81,7 +79,7 @@ public void testSingle() throws Exception { latch.countDown(); }); latch.await(5, TimeUnit.SECONDS); - assertEquals("got it", value.get()); + Assertions.assertEquals("got it", value.get()); } @Test @@ -92,7 +90,7 @@ public void testSingleContext() throws Exception { latch.countDown(); }); latch.await(5, TimeUnit.SECONDS); - assertEquals("got it", value.get()); + Assertions.assertEquals("got it", value.get()); } @Test @@ -106,7 +104,7 @@ public void testObservable() throws Exception { (Throwable t) -> LOG.error(t.getMessage(), t), () -> latch.countDown()); latch.await(5, TimeUnit.SECONDS); - assertArrayEquals(new String[] { "one", "two" }, data.toArray()); + Assertions.assertArrayEquals(new String[] { "one", "two" }, data.toArray()); } @Test @@ -121,7 +119,7 @@ public void testObservableContext() throws Exception { (Throwable t) -> LOG.error(t.getMessage(), t), () -> latch.countDown()); latch.await(5, TimeUnit.SECONDS); - assertArrayEquals(new String[] { "one", "two" }, data.toArray()); + Assertions.assertArrayEquals(new String[] { "one", "two" }, data.toArray()); } @Test @@ -135,7 +133,7 @@ public void testFlowable() throws Exception { (Throwable t) -> LOG.error(t.getMessage(), t), () -> latch.countDown()); latch.await(5, TimeUnit.SECONDS); - assertArrayEquals(new String[] { "one", "two" }, data.toArray()); + Assertions.assertArrayEquals(new String[] { "one", "two" }, data.toArray()); } @Test @@ -152,7 +150,7 @@ public void testFlowablecontext() throws Exception { LOG.info("onComplete()"); }); latch.await(5, TimeUnit.SECONDS); - assertArrayEquals(new String[] { "one", "two" }, data.toArray()); + Assertions.assertArrayEquals(new String[] { "one", "two" }, data.toArray()); } // @Test @@ -160,16 +158,16 @@ public void testChunked() throws Exception { Invocation.Builder request = client.target(generateURL("/chunked")).request(); Response response = request.get(); String entity = response.readEntity(String.class); - Assert.assertEquals(200, response.getStatus()); - Assert.assertEquals("onetwo", entity); + Assertions.assertEquals(200, response.getStatus()); + Assertions.assertEquals("onetwo", entity); } @Test public void testInjection() { Integer data = client.target(generateURL("/injection")).request().get(Integer.class); - assertEquals((Integer) 42, data); + Assertions.assertEquals((Integer) 42, data); data = client.target(generateURL("/injection-async")).request().get(Integer.class); - assertEquals((Integer) 42, data); + Assertions.assertEquals((Integer) 42, data); } } diff --git a/resteasy-rxjava2/src/test/java/org/jboss/resteasy/rxjava2/SingleProviderTest.java b/resteasy-rxjava2/src/test/java/org/jboss/resteasy/rxjava2/SingleProviderTest.java index 84cb957cd1d..8bb8f22ad35 100644 --- a/resteasy-rxjava2/src/test/java/org/jboss/resteasy/rxjava2/SingleProviderTest.java +++ b/resteasy-rxjava2/src/test/java/org/jboss/resteasy/rxjava2/SingleProviderTest.java @@ -1,14 +1,11 @@ package org.jboss.resteasy.rxjava2; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import io.reactivex.Single; @@ -20,7 +17,7 @@ public void testFromCompletionStage() { final CompletableFuture cs = new CompletableFuture<>(); cs.complete(1); final Single single = provider.fromCompletionStage(cs); - assertEquals(1, single.blockingGet()); + Assertions.assertEquals(1, single.blockingGet()); } @Test @@ -28,9 +25,9 @@ public void testFromCompletionStageNotDeferred() throws InterruptedException { final CountDownLatch latch = new CountDownLatch(1); final Single single = provider.fromCompletionStage(someAsyncMethod(latch)); - assertTrue(latch.await(1, TimeUnit.SECONDS)); - assertEquals("Hello!", single.blockingGet()); - assertEquals(0, latch.getCount()); + Assertions.assertTrue(latch.await(1, TimeUnit.SECONDS)); + Assertions.assertEquals("Hello!", single.blockingGet()); + Assertions.assertEquals(0, latch.getCount()); } @Test @@ -38,9 +35,9 @@ public void testFromCompletionStageDeferred() throws InterruptedException { final CountDownLatch latch = new CountDownLatch(1); final Single single = provider.fromCompletionStage(() -> someAsyncMethod(latch)); - assertFalse(latch.await(1, TimeUnit.SECONDS)); - assertEquals("Hello!", single.blockingGet()); - assertEquals(0, latch.getCount()); + Assertions.assertFalse(latch.await(1, TimeUnit.SECONDS)); + Assertions.assertEquals("Hello!", single.blockingGet()); + Assertions.assertEquals(0, latch.getCount()); } private CompletableFuture someAsyncMethod(final CountDownLatch latch) { @@ -51,6 +48,6 @@ private CompletableFuture someAsyncMethod(final CountDownLatch latch) { @Test public void testToCompletionStageCase() throws Exception { final Object actual = provider.toCompletionStage(Single.just(1)).toCompletableFuture().get(); - assertEquals(1, actual); + Assertions.assertEquals(1, actual); } } diff --git a/resteasy-rxjava2/src/test/java/org/jboss/resteasy/test/i18n/TestMessagesAbstract.java b/resteasy-rxjava2/src/test/java/org/jboss/resteasy/test/i18n/TestMessagesAbstract.java index 284a4031b2c..dddf4775ae1 100644 --- a/resteasy-rxjava2/src/test/java/org/jboss/resteasy/test/i18n/TestMessagesAbstract.java +++ b/resteasy-rxjava2/src/test/java/org/jboss/resteasy/test/i18n/TestMessagesAbstract.java @@ -7,8 +7,8 @@ import org.jboss.logging.Logger; import org.jboss.resteasy.rxjava2.i18n.Messages; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; /** * @@ -33,7 +33,7 @@ public void testLocale() throws Exception { return; } - Assert.assertEquals(getExpected(BASE + "00", "expectedClientInvocationBuilder", "abc"), + Assertions.assertEquals(getExpected(BASE + "00", "expectedClientInvocationBuilder", "abc"), Messages.MESSAGES.expectedClientInvocationBuilder("abc")); } diff --git a/resteasy-rxjava2/src/test/java/org/jboss/resteasy/test/i18n/TestMessagesParent.java b/resteasy-rxjava2/src/test/java/org/jboss/resteasy/test/i18n/TestMessagesParent.java index 36a70952685..60553dd1877 100644 --- a/resteasy-rxjava2/src/test/java/org/jboss/resteasy/test/i18n/TestMessagesParent.java +++ b/resteasy-rxjava2/src/test/java/org/jboss/resteasy/test/i18n/TestMessagesParent.java @@ -5,8 +5,8 @@ import java.util.Properties; import org.jboss.logging.Logger; -import org.junit.AfterClass; -import org.junit.BeforeClass; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; /** * @@ -19,12 +19,12 @@ public abstract class TestMessagesParent { protected static Locale savedLocale; protected Properties properties = new Properties(); - @BeforeClass + @BeforeAll public static void beforeClass() { savedLocale = Locale.getDefault(); } - @AfterClass + @AfterAll public static void afterClass() { Locale.setDefault(savedLocale); LOG.info("Reset default locale to: " + savedLocale);