This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 99f5084634dba7b1aefbd529bc27757a8c48bbc9 Author: Guillaume Nodet <[email protected]> AuthorDate: Mon Jul 27 14:22:45 2020 +0200 [CAMEL-11807] Upgrade camel-pulsar to junit5 --- components/camel-pulsar/pom.xml | 10 +++++----- .../component/pulsar/PulsarComponentTest.java | 13 ++++++++---- .../pulsar/PulsarConcurrentConsumerInTest.java | 4 +++- .../pulsar/PulsarConcurrentProducerInTest.java | 2 +- .../pulsar/PulsarConsumerAcknowledgementTest.java | 8 +++++--- .../pulsar/PulsarConsumerDeadLetterPolicyTest.java | 8 +++++--- .../pulsar/PulsarConsumerInAsynchronousTest.java | 4 +++- .../pulsar/PulsarConsumerInSynchronousTest.java | 4 +++- .../component/pulsar/PulsarConsumerInTest.java | 2 +- .../PulsarConsumerNoAcknowledgementTest.java | 2 +- .../pulsar/PulsarConsumerPatternInTest.java | 2 +- .../pulsar/PulsarCustomMessageReceiptTest.java | 6 +++--- .../camel/component/pulsar/PulsarEndpointTest.java | 8 ++++++-- .../pulsar/PulsarProducerHeadersInTest.java | 2 +- .../component/pulsar/PulsarProducerInTest.java | 2 +- .../PulsarProducerUndefinedProducerNameInTest.java | 2 +- .../camel/component/pulsar/PulsarTestSupport.java | 23 ++++++++++++++++++++-- .../component/pulsar/utils/PulsarUtilsTest.java | 10 ++++++---- .../ConsumerCreationStrategyFactoryTest.java | 12 ++++++----- .../utils/message/PulsarMessageUtilsTest.java | 4 ++-- 20 files changed, 85 insertions(+), 43 deletions(-) diff --git a/components/camel-pulsar/pom.xml b/components/camel-pulsar/pom.xml index 876ed1c..4d1c20c 100644 --- a/components/camel-pulsar/pom.xml +++ b/components/camel-pulsar/pom.xml @@ -51,22 +51,22 @@ <!-- testing --> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-test</artifactId> + <artifactId>camel-test-junit5</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-testcontainers</artifactId> + <artifactId>camel-testcontainers-junit5</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> + <artifactId>mockito-junit-jupiter</artifactId> <scope>test</scope> </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> <scope>test</scope> </dependency> diff --git a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarComponentTest.java b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarComponentTest.java index 269b3b5..bb63488 100644 --- a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarComponentTest.java +++ b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarComponentTest.java @@ -18,11 +18,16 @@ package org.apache.camel.component.pulsar; import org.apache.camel.component.pulsar.utils.AutoConfiguration; import org.apache.camel.component.pulsar.utils.consumers.SubscriptionType; -import org.apache.camel.test.junit4.CamelTestSupport; -import org.junit.Before; -import org.junit.Test; +import org.apache.camel.test.junit5.CamelTestSupport; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentMatchers; +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.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -32,7 +37,7 @@ public class PulsarComponentTest extends CamelTestSupport { private AutoConfiguration autoConfiguration; @Override - @Before + @BeforeEach public void setUp() throws Exception { autoConfiguration = mock(AutoConfiguration.class); super.setUp(); diff --git a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConcurrentConsumerInTest.java b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConcurrentConsumerInTest.java index c859d30..8b9e685 100644 --- a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConcurrentConsumerInTest.java +++ b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConcurrentConsumerInTest.java @@ -32,7 +32,7 @@ import org.apache.pulsar.client.api.PulsarClient; import org.apache.pulsar.client.api.PulsarClientException; import org.apache.pulsar.client.api.Schema; import org.apache.pulsar.client.impl.ClientBuilderImpl; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -104,7 +104,9 @@ public class PulsarConcurrentConsumerInTest extends PulsarTestSupport { producer.send("Hello World!"); } + System.out.println(NUMBER_OF_CONSUMERS + " messages sent, waiting for receival"); MockEndpoint.assertIsSatisfied(10, TimeUnit.SECONDS, to); + System.out.println("Messages received"); producer.close(); } diff --git a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConcurrentProducerInTest.java b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConcurrentProducerInTest.java index d3b4622..3c76a86 100644 --- a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConcurrentProducerInTest.java +++ b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConcurrentProducerInTest.java @@ -32,7 +32,7 @@ import org.apache.camel.support.SimpleRegistry; import org.apache.pulsar.client.api.PulsarClient; import org.apache.pulsar.client.api.PulsarClientException; import org.apache.pulsar.client.impl.ClientBuilderImpl; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class PulsarConcurrentProducerInTest extends PulsarTestSupport { diff --git a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerAcknowledgementTest.java b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerAcknowledgementTest.java index d2548b0..3fbbba0 100644 --- a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerAcknowledgementTest.java +++ b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerAcknowledgementTest.java @@ -32,11 +32,13 @@ import org.apache.pulsar.client.api.PulsarClient; import org.apache.pulsar.client.api.PulsarClientException; import org.apache.pulsar.client.api.Schema; import org.apache.pulsar.client.impl.ClientBuilderImpl; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.apache.camel.test.junit5.TestSupport.body; + public class PulsarConsumerAcknowledgementTest extends PulsarTestSupport { private static final Logger LOGGER = LoggerFactory.getLogger(PulsarConsumerAcknowledgementTest.class); @@ -53,7 +55,7 @@ public class PulsarConsumerAcknowledgementTest extends PulsarTestSupport { private Producer<String> producer; - @Before + @BeforeEach public void setup() throws Exception { context.removeRoute("myRoute"); producer = givenPulsarClient().newProducer(Schema.STRING).producerName(PRODUCER).topic(TOPIC_URI).create(); diff --git a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerDeadLetterPolicyTest.java b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerDeadLetterPolicyTest.java index fc0ebdb..c970fb7 100644 --- a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerDeadLetterPolicyTest.java +++ b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerDeadLetterPolicyTest.java @@ -30,8 +30,10 @@ import org.apache.pulsar.client.api.PulsarClient; import org.apache.pulsar.client.api.PulsarClientException; import org.apache.pulsar.client.api.Schema; import org.apache.pulsar.client.impl.ClientBuilderImpl; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertNull; public class PulsarConsumerDeadLetterPolicyTest extends PulsarTestSupport { @@ -66,7 +68,7 @@ public class PulsarConsumerDeadLetterPolicyTest extends PulsarTestSupport { registry.bind("pulsar", comp); } - @Before + @BeforeEach public void buildProducer() throws PulsarClientException { try { context.removeRoute("myRoute"); diff --git a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerInAsynchronousTest.java b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerInAsynchronousTest.java index 4f9b9ec..1f42c9c 100644 --- a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerInAsynchronousTest.java +++ b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerInAsynchronousTest.java @@ -34,10 +34,12 @@ import org.apache.pulsar.client.api.PulsarClient; import org.apache.pulsar.client.api.PulsarClientException; import org.apache.pulsar.client.api.Schema; import org.apache.pulsar.client.impl.ClientBuilderImpl; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.apache.camel.test.junit5.TestSupport.body; + public class PulsarConsumerInAsynchronousTest extends PulsarTestSupport { private static final Logger LOGGER = LoggerFactory.getLogger(PulsarConsumerInAsynchronousTest.class); diff --git a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerInSynchronousTest.java b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerInSynchronousTest.java index 73cda55..a9b127d 100644 --- a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerInSynchronousTest.java +++ b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerInSynchronousTest.java @@ -34,10 +34,12 @@ import org.apache.pulsar.client.api.PulsarClient; import org.apache.pulsar.client.api.PulsarClientException; import org.apache.pulsar.client.api.Schema; import org.apache.pulsar.client.impl.ClientBuilderImpl; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.apache.camel.test.junit5.TestSupport.body; + public class PulsarConsumerInSynchronousTest extends PulsarTestSupport { private static final Logger LOGGER = LoggerFactory.getLogger(PulsarConsumerInAsynchronousTest.class); diff --git a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerInTest.java b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerInTest.java index 8ff9e91..ba217ec 100644 --- a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerInTest.java +++ b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerInTest.java @@ -32,7 +32,7 @@ import org.apache.pulsar.client.api.PulsarClient; import org.apache.pulsar.client.api.PulsarClientException; import org.apache.pulsar.client.api.Schema; import org.apache.pulsar.client.impl.ClientBuilderImpl; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerNoAcknowledgementTest.java b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerNoAcknowledgementTest.java index 4769302..8b2f018 100644 --- a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerNoAcknowledgementTest.java +++ b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerNoAcknowledgementTest.java @@ -30,7 +30,7 @@ import org.apache.pulsar.client.api.PulsarClient; import org.apache.pulsar.client.api.PulsarClientException; import org.apache.pulsar.client.api.Schema; import org.apache.pulsar.client.impl.ClientBuilderImpl; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class PulsarConsumerNoAcknowledgementTest extends PulsarTestSupport { diff --git a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerPatternInTest.java b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerPatternInTest.java index bbb4447..66b4a25 100644 --- a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerPatternInTest.java +++ b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarConsumerPatternInTest.java @@ -32,7 +32,7 @@ import org.apache.pulsar.client.api.PulsarClient; import org.apache.pulsar.client.api.PulsarClientException; import org.apache.pulsar.client.api.Schema; import org.apache.pulsar.client.impl.ClientBuilderImpl; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarCustomMessageReceiptTest.java b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarCustomMessageReceiptTest.java index 3cdb832..e2e54a3 100644 --- a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarCustomMessageReceiptTest.java +++ b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarCustomMessageReceiptTest.java @@ -31,8 +31,8 @@ import org.apache.pulsar.client.api.PulsarClient; import org.apache.pulsar.client.api.PulsarClientException; import org.apache.pulsar.client.api.Schema; import org.apache.pulsar.client.impl.ClientBuilderImpl; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -63,7 +63,7 @@ public class PulsarCustomMessageReceiptTest extends PulsarTestSupport { private Producer<String> producer; - @Before + @BeforeEach public void setup() throws Exception { producer = givenPulsarClient().newProducer(Schema.STRING).producerName(PRODUCER).topic(TOPIC_URI).create(); } diff --git a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarEndpointTest.java b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarEndpointTest.java index ea836de..ccae4d8b 100644 --- a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarEndpointTest.java +++ b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarEndpointTest.java @@ -17,8 +17,12 @@ package org.apache.camel.component.pulsar; import org.apache.camel.ResolveEndpointFailedException; -import org.apache.camel.test.junit4.CamelTestSupport; -import org.junit.Test; +import org.apache.camel.test.junit5.CamelTestSupport; +import org.junit.jupiter.api.Test; + +import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; public class PulsarEndpointTest extends CamelTestSupport { diff --git a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarProducerHeadersInTest.java b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarProducerHeadersInTest.java index 299aa71..426a80d 100644 --- a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarProducerHeadersInTest.java +++ b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarProducerHeadersInTest.java @@ -33,7 +33,7 @@ import org.apache.camel.support.SimpleRegistry; import org.apache.pulsar.client.api.PulsarClient; import org.apache.pulsar.client.api.PulsarClientException; import org.apache.pulsar.client.impl.ClientBuilderImpl; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class PulsarProducerHeadersInTest extends PulsarTestSupport { diff --git a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarProducerInTest.java b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarProducerInTest.java index 52b274e..bde0513 100644 --- a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarProducerInTest.java +++ b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarProducerInTest.java @@ -30,7 +30,7 @@ import org.apache.camel.support.SimpleRegistry; import org.apache.pulsar.client.api.PulsarClient; import org.apache.pulsar.client.api.PulsarClientException; import org.apache.pulsar.client.impl.ClientBuilderImpl; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class PulsarProducerInTest extends PulsarTestSupport { diff --git a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarProducerUndefinedProducerNameInTest.java b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarProducerUndefinedProducerNameInTest.java index c65d9ad..b038517 100644 --- a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarProducerUndefinedProducerNameInTest.java +++ b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarProducerUndefinedProducerNameInTest.java @@ -30,7 +30,7 @@ import org.apache.camel.support.SimpleRegistry; import org.apache.pulsar.client.api.PulsarClient; import org.apache.pulsar.client.api.PulsarClientException; import org.apache.pulsar.client.impl.ClientBuilderImpl; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class PulsarProducerUndefinedProducerNameInTest extends PulsarTestSupport { diff --git a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarTestSupport.java b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarTestSupport.java index bd9961f..4a525a6 100644 --- a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarTestSupport.java +++ b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarTestSupport.java @@ -16,8 +16,13 @@ */ package org.apache.camel.component.pulsar; -import org.apache.camel.test.testcontainers.ContainerAwareTestSupport; -import org.apache.camel.test.testcontainers.Wait; +import java.time.Duration; +import java.time.Instant; +import java.util.concurrent.TimeUnit; + +import org.apache.camel.test.testcontainers.junit5.ContainerAwareTestSupport; +import org.apache.camel.test.testcontainers.junit5.Wait; +import org.junit.jupiter.api.TestInstance; import org.testcontainers.containers.GenericContainer; public class PulsarTestSupport extends ContainerAwareTestSupport { @@ -46,4 +51,18 @@ public class PulsarTestSupport extends ContainerAwareTestSupport { public String getPulsarAdminUrl() { return String.format("http://%s:%s", getContainer(CONTAINER_NAME).getContainerIpAddress(), getContainer(CONTAINER_NAME).getMappedPort(BROKER_HTTP_PORT)); } + + protected long containerShutdownTimeout() { + return TimeUnit.SECONDS.toSeconds(10); + } + + protected void cleanupResources() throws Exception { + System.out.println("Cleaning up resources"); + Instant t0 = Instant.now(); + try { + super.cleanupResources(); + } finally { + System.out.println("Resources clean up in " + Duration.between(t0, Instant.now())); + } + } } diff --git a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/utils/PulsarUtilsTest.java b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/utils/PulsarUtilsTest.java index f36f1e3..8e825f7 100644 --- a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/utils/PulsarUtilsTest.java +++ b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/utils/PulsarUtilsTest.java @@ -21,9 +21,10 @@ import java.util.concurrent.ConcurrentLinkedQueue; import org.apache.pulsar.client.api.Consumer; import org.apache.pulsar.client.api.PulsarClientException; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -59,13 +60,14 @@ public class PulsarUtilsTest { verify(consumer).close(); } - @Test(expected = PulsarClientException.class) + @Test public void givenConsumerThrowsPulsarClientExceptionwhenIStopConsumersverifyExceptionIsThrown() throws PulsarClientException { Consumer<byte[]> consumer = mock(Consumer.class); doThrow(new PulsarClientException("A Pulsar Client exception occurred")).when(consumer).close(); - consumer.close(); + assertThrows(PulsarClientException.class, + () -> consumer.close()); verify(consumer).close(); } diff --git a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/utils/consumers/ConsumerCreationStrategyFactoryTest.java b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/utils/consumers/ConsumerCreationStrategyFactoryTest.java index de45ca7..683ae8a 100644 --- a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/utils/consumers/ConsumerCreationStrategyFactoryTest.java +++ b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/utils/consumers/ConsumerCreationStrategyFactoryTest.java @@ -17,17 +17,19 @@ package org.apache.camel.component.pulsar.utils.consumers; import org.apache.camel.component.pulsar.PulsarConsumer; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.mock; public class ConsumerCreationStrategyFactoryTest { - @Test(expected = IllegalArgumentException.class) + @Test public void givenPulsarConsumerIsNullwhenICreateFactoryverifyIllegalArgumentExceptionIsThrown() { - ConsumerCreationStrategyFactory.create(null); + assertThrows(IllegalArgumentException.class, + () -> ConsumerCreationStrategyFactory.create(null)); } @Test diff --git a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/utils/message/PulsarMessageUtilsTest.java b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/utils/message/PulsarMessageUtilsTest.java index 0753d50..18deba9 100644 --- a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/utils/message/PulsarMessageUtilsTest.java +++ b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/utils/message/PulsarMessageUtilsTest.java @@ -18,9 +18,9 @@ package org.apache.camel.component.pulsar.utils.message; import java.io.Serializable; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotNull; public class PulsarMessageUtilsTest {
