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 55b6f6dfbf83a5b92e6591fd82d73d3d442446f9 Author: Guillaume Nodet <gno...@gmail.com> AuthorDate: Wed Jul 22 17:58:45 2020 +0200 [CAMEL-11807] Upgrade camel-smpp to junit5 --- components/camel-smpp/pom.xml | 13 ++++++--- .../component/smpp/AbstractSmppCommandTest.java | 8 +++--- .../smpp/MessageReceiverListenerImplTest.java | 10 +++---- .../camel/component/smpp/Smpp8BitSplitterTest.java | 6 ++-- .../camel/component/smpp/SmppBindingTest.java | 32 +++++++++++----------- .../component/smpp/SmppCancelSmCommandTest.java | 8 +++--- .../camel/component/smpp/SmppCommandTypeTest.java | 8 +++--- .../camel/component/smpp/SmppComponentTest.java | 14 +++++----- .../component/smpp/SmppConfigurationTest.java | 10 +++---- .../component/smpp/SmppConnectionFactoryTest.java | 26 ++++++++++-------- .../camel/component/smpp/SmppConsumerTest.java | 8 +++--- .../component/smpp/SmppDataSmCommandTest.java | 22 +++++++-------- .../component/smpp/SmppDefaultSplitterTest.java | 6 ++-- .../camel/component/smpp/SmppMessageTest.java | 18 ++++++------ .../camel/component/smpp/SmppNLSTSplitterTest.java | 6 ++-- .../smpp/SmppProducerLazySessionCreationTest.java | 6 ++-- .../camel/component/smpp/SmppProducerTest.java | 8 +++--- .../component/smpp/SmppQuerySmCommandTest.java | 10 +++---- .../component/smpp/SmppReplaceSmCommandTest.java | 16 +++++------ .../camel/component/smpp/SmppSplitterTest.java | 6 ++-- .../component/smpp/SmppSubmitMultiCommandTest.java | 22 +++++++-------- .../component/smpp/SmppSubmitSmCommandTest.java | 28 +++++++++---------- .../camel/component/smpp/SmppUcs2SplitterTest.java | 6 ++-- .../apache/camel/component/smpp/SmppUtilsTest.java | 12 ++++---- .../integration/SmppComponentIntegrationTest.java | 12 +++++--- .../SmppComponentSpringIntegrationTest.java | 12 +++++--- .../SmppConsumerReconnectIntegrationTest.java | 8 +++--- .../SmppProducerReconnectIntegrationTest.java | 8 +++--- 28 files changed, 181 insertions(+), 168 deletions(-) diff --git a/components/camel-smpp/pom.xml b/components/camel-smpp/pom.xml index 5c44258..6417736 100644 --- a/components/camel-smpp/pom.xml +++ b/components/camel-smpp/pom.xml @@ -48,18 +48,23 @@ <!-- testing --> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-test-spring</artifactId> + <artifactId>camel-test-spring-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>org.hamcrest</groupId> + <artifactId>hamcrest</artifactId> <scope>test</scope> </dependency> <dependency> diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/AbstractSmppCommandTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/AbstractSmppCommandTest.java index a7e5d57..802f50c 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/AbstractSmppCommandTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/AbstractSmppCommandTest.java @@ -23,10 +23,10 @@ import org.apache.camel.support.DefaultExchange; import org.jsmpp.bean.OptionalParameter; import org.jsmpp.bean.OptionalParameter.Tag; import org.jsmpp.session.SMPPSession; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertSame; +import static org.junit.jupiter.api.Assertions.assertSame; public class AbstractSmppCommandTest { @@ -34,7 +34,7 @@ public class AbstractSmppCommandTest { private SmppConfiguration config = new SmppConfiguration(); private AbstractSmppCommand command; - @Before + @BeforeEach public void setUp() { session = new SMPPSession(); config = new SmppConfiguration(); diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/MessageReceiverListenerImplTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/MessageReceiverListenerImplTest.java index 2762bd9..6e14540 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/MessageReceiverListenerImplTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/MessageReceiverListenerImplTest.java @@ -28,11 +28,11 @@ import org.jsmpp.session.DataSmResult; import org.jsmpp.session.SMPPSession; import org.jsmpp.util.MessageIDGenerator; import org.jsmpp.util.MessageId; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertSame; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertSame; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -44,7 +44,7 @@ public class MessageReceiverListenerImplTest { private Processor processor; private ExceptionHandler exceptionHandler; - @Before + @BeforeEach public void setUp() { endpoint = mock(SmppEndpoint.class); processor = mock(Processor.class); diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/Smpp8BitSplitterTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/Smpp8BitSplitterTest.java index 92edc9b..e6559c3 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/Smpp8BitSplitterTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/Smpp8BitSplitterTest.java @@ -16,10 +16,10 @@ */ package org.apache.camel.component.smpp; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class Smpp8BitSplitterTest { diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppBindingTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppBindingTest.java index 77eb702..57185a3 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppBindingTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppBindingTest.java @@ -35,16 +35,16 @@ import org.jsmpp.bean.OptionalParameter.Tag; import org.jsmpp.bean.TypeOfNumber; import org.jsmpp.session.SMPPSession; import org.jsmpp.util.DeliveryReceiptState; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertArrayEquals; -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.Assert.fail; +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; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; /** * JUnit test class for <code>org.apache.camel.component.smpp.SmppBinding</code> @@ -54,7 +54,7 @@ public class SmppBindingTest { private SmppBinding binding; private CamelContext camelContext; - @Before + @BeforeEach public void setUp() { binding = new SmppBinding() { Date getCurrentDate() { @@ -161,7 +161,7 @@ public class SmppBindingTest { assertEquals(Byte.valueOf((byte) 0x01), optionalParameters.get("DEST_ADDR_SUBUNIT")); assertEquals(Short.valueOf((short) 1), optionalParameters.get("DEST_TELEMATICS_ID")); assertEquals(Integer.valueOf(1), optionalParameters.get("QOS_TIME_TO_LIVE")); - assertNull("0x00", optionalParameters.get("ALERT_ON_MESSAGE_DELIVERY")); + assertNull(optionalParameters.get("ALERT_ON_MESSAGE_DELIVERY"), "0x00"); Map<Short, Object> optionalParameter = smppMessage.getHeader(SmppConstants.OPTIONAL_PARAMETER, Map.class); assertEquals(6, optionalParameter.size()); @@ -170,7 +170,7 @@ public class SmppBindingTest { assertEquals(Byte.valueOf((byte) 0x01), optionalParameter.get(Short.valueOf((short) 0x0005))); assertEquals(Short.valueOf((short) 1), optionalParameter.get(Short.valueOf((short) 0x0008))); assertEquals(Integer.valueOf(1), optionalParameter.get(Short.valueOf((short) 0x0017))); - assertNull("0x00", optionalParameter.get(Short.valueOf((short) 0x130C))); + assertNull(optionalParameter.get(Short.valueOf((short) 0x130C)), "0x00"); } @Test @@ -336,11 +336,11 @@ public class SmppBindingTest { binding.getConfiguration().setEncoding(encoding); SmppMessage smppMessage = binding.createSmppMessage(camelContext, deliverSm); assertArrayEquals( - String.format("data coding=0x%02X; encoding=%s", - dataCoding, - encoding), body, - smppMessage.getBody(byte[].class)); + smppMessage.getBody(byte[].class), + String.format("data coding=0x%02X; encoding=%s", + dataCoding, + encoding)); } } } diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppCancelSmCommandTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppCancelSmCommandTest.java index 9cb3a66..5be79c0 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppCancelSmCommandTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppCancelSmCommandTest.java @@ -23,10 +23,10 @@ import org.apache.camel.support.DefaultExchange; import org.jsmpp.bean.NumberingPlanIndicator; import org.jsmpp.bean.TypeOfNumber; import org.jsmpp.session.SMPPSession; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -36,7 +36,7 @@ public class SmppCancelSmCommandTest { private SmppConfiguration config; private SmppCancelSmCommand command; - @Before + @BeforeEach public void setUp() { session = mock(SMPPSession.class); config = new SmppConfiguration(); diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppCommandTypeTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppCommandTypeTest.java index e896b76..1b42151 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppCommandTypeTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppCommandTypeTest.java @@ -19,16 +19,16 @@ package org.apache.camel.component.smpp; import org.apache.camel.Exchange; import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.support.DefaultExchange; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertSame; +import static org.junit.jupiter.api.Assertions.assertSame; public class SmppCommandTypeTest { private Exchange exchange; - @Before + @BeforeEach public void setUp() { exchange = new DefaultExchange(new DefaultCamelContext()); } diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppComponentTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppComponentTest.java index 9262414..052be81 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppComponentTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppComponentTest.java @@ -23,13 +23,13 @@ import org.apache.camel.CamelContext; import org.apache.camel.Endpoint; import org.apache.camel.ExchangePattern; import org.apache.camel.impl.DefaultCamelContext; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * JUnit test class for <code>org.apache.camel.component.smpp.SmppComponent</code> @@ -39,7 +39,7 @@ public class SmppComponentTest { private SmppComponent component; private DefaultCamelContext context; - @Before + @BeforeEach public void setUp() { context = new DefaultCamelContext(); context.start(); diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConfigurationTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConfigurationTest.java index 5ce9c90..481a666 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConfigurationTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConfigurationTest.java @@ -27,11 +27,11 @@ import org.jsmpp.bean.TypeOfNumber; import org.jsmpp.extra.SessionState; import org.jsmpp.session.Session; import org.jsmpp.session.SessionStateListener; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +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; /** * JUnit test class for <code>org.apache.camel.component.smpp.SmppConfiguration</code> @@ -40,7 +40,7 @@ public class SmppConfigurationTest { private SmppConfiguration configuration; - @Before + @BeforeEach public void setUp() { configuration = new SmppConfiguration(); configuration.setServiceType("CMT"); diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConnectionFactoryTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConnectionFactoryTest.java index 49d8629..b3b650e 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConnectionFactoryTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConnectionFactoryTest.java @@ -19,9 +19,11 @@ package org.apache.camel.component.smpp; import java.io.IOException; import org.jsmpp.session.connection.Connection; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * JUnit test class for <code>org.apache.camel.component.smpp.SmppConnectionFactory</code> @@ -29,15 +31,15 @@ import org.junit.Test; public class SmppConnectionFactoryTest { @Test - @Ignore("Must be manually tested") + @Disabled("Must be manually tested") public void createConnection() throws IOException { SmppConfiguration configuration = new SmppConfiguration(); SmppConnectionFactory factory = SmppConnectionFactory.getInstance(configuration); Connection connection = factory.createConnection("localhost", 2775); try { - Assert.assertNotNull(connection); - Assert.assertTrue(connection.isOpen()); + assertNotNull(connection); + assertTrue(connection.isOpen()); } finally { if (connection != null) { connection.close(); @@ -46,7 +48,7 @@ public class SmppConnectionFactoryTest { } @Test - @Ignore("Must be manually tested") + @Disabled("Must be manually tested") public void createConnectionWithProxyHost() throws IOException { SmppConfiguration configuration = new SmppConfiguration(); configuration.setHttpProxyHost("localhost"); @@ -55,8 +57,8 @@ public class SmppConnectionFactoryTest { Connection connection = factory.createConnection("localhost", 2775); try { - Assert.assertNotNull(connection); - Assert.assertTrue(connection.isOpen()); + assertNotNull(connection); + assertTrue(connection.isOpen()); } finally { if (connection != null) { connection.close(); @@ -65,7 +67,7 @@ public class SmppConnectionFactoryTest { } @Test - @Ignore("Must be manually tested") + @Disabled("Must be manually tested") public void createConnectionWithProxyUsername() throws IOException { SmppConfiguration configuration = new SmppConfiguration(); configuration.setHttpProxyHost("localhost"); @@ -76,8 +78,8 @@ public class SmppConnectionFactoryTest { Connection connection = factory.createConnection("localhost", 2775); try { - Assert.assertNotNull(connection); - Assert.assertTrue(connection.isOpen()); + assertNotNull(connection); + assertTrue(connection.isOpen()); } finally { if (connection != null) { connection.close(); diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConsumerTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConsumerTest.java index 05e5ce7..271a582 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConsumerTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConsumerTest.java @@ -24,10 +24,10 @@ import org.jsmpp.session.BindParameter; import org.jsmpp.session.MessageReceiverListener; import org.jsmpp.session.SMPPSession; import org.jsmpp.session.SessionStateListener; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertSame; +import static org.junit.jupiter.api.Assertions.assertSame; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; @@ -45,7 +45,7 @@ public class SmppConsumerTest { private Processor processor; private SMPPSession session; - @Before + @BeforeEach public void setUp() { configuration = new SmppConfiguration(); configuration.setServiceType("CMT"); diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppDataSmCommandTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppDataSmCommandTest.java index 149c50f..456352e 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppDataSmCommandTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppDataSmCommandTest.java @@ -35,14 +35,14 @@ import org.jsmpp.bean.TypeOfNumber; import org.jsmpp.session.DataSmResult; import org.jsmpp.session.SMPPSession; import org.jsmpp.util.MessageId; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -55,21 +55,21 @@ public class SmppDataSmCommandTest { private SmppConfiguration config; private SmppDataSmCommand command; - @BeforeClass + @BeforeAll public static void setUpBeforeClass() { defaultTimeZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("GMT")); } - @AfterClass + @AfterAll public static void tearDownAfterClass() { if (defaultTimeZone != null) { TimeZone.setDefault(defaultTimeZone); } } - @Before + @BeforeEach public void setUp() { session = mock(SMPPSession.class); config = new SmppConfiguration(); diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppDefaultSplitterTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppDefaultSplitterTest.java index 847d414..bdc8eea 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppDefaultSplitterTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppDefaultSplitterTest.java @@ -16,10 +16,10 @@ */ package org.apache.camel.component.smpp; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class SmppDefaultSplitterTest { diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppMessageTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppMessageTest.java index 8600b79..90e60d1 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppMessageTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppMessageTest.java @@ -24,13 +24,13 @@ import org.apache.camel.impl.DefaultCamelContext; import org.jsmpp.bean.AlertNotification; import org.jsmpp.bean.DataSm; import org.jsmpp.bean.DeliverSm; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.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.assertTrue; /** * JUnit test class for <code>org.apache.camel.component.smpp.SmppMessage</code> @@ -127,10 +127,10 @@ public class SmppMessageTest { message = new SmppMessage(camelContext, command, config); assertArrayEquals( + body, (byte[])message.createBody(), String.format("data coding=0x%02X; encoding=%s", - dataCoding, - encoding), - body, (byte[])message.createBody()); + dataCoding, + encoding)); } } } diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppNLSTSplitterTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppNLSTSplitterTest.java index 92eb3d6..84b70dc8 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppNLSTSplitterTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppNLSTSplitterTest.java @@ -16,10 +16,10 @@ */ package org.apache.camel.component.smpp; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class SmppNLSTSplitterTest { diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppProducerLazySessionCreationTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppProducerLazySessionCreationTest.java index 40afcf7..5fd80cf 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppProducerLazySessionCreationTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppProducerLazySessionCreationTest.java @@ -24,8 +24,8 @@ import org.jsmpp.bean.TypeOfNumber; import org.jsmpp.session.BindParameter; import org.jsmpp.session.SMPPSession; import org.jsmpp.session.SessionStateListener; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.mock; @@ -42,7 +42,7 @@ public class SmppProducerLazySessionCreationTest { private SmppEndpoint endpoint; private SMPPSession session; - @Before + @BeforeEach public void setUp() { configuration = new SmppConfiguration(); configuration.setLazySessionCreation(true); diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppProducerTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppProducerTest.java index b7c3e84..9d1a73ee 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppProducerTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppProducerTest.java @@ -23,10 +23,10 @@ import org.jsmpp.bean.TypeOfNumber; import org.jsmpp.session.BindParameter; import org.jsmpp.session.SMPPSession; import org.jsmpp.session.SessionStateListener; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertSame; +import static org.junit.jupiter.api.Assertions.assertSame; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -42,7 +42,7 @@ public class SmppProducerTest { private SmppEndpoint endpoint; private SMPPSession session; - @Before + @BeforeEach public void setUp() { configuration = new SmppConfiguration(); configuration.setServiceType("CMT"); diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppQuerySmCommandTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppQuerySmCommandTest.java index 6ce0423..1955b51 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppQuerySmCommandTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppQuerySmCommandTest.java @@ -25,11 +25,11 @@ import org.jsmpp.bean.NumberingPlanIndicator; import org.jsmpp.bean.TypeOfNumber; import org.jsmpp.session.QuerySmResult; import org.jsmpp.session.SMPPSession; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +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.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -39,7 +39,7 @@ public class SmppQuerySmCommandTest { private SmppConfiguration config; private SmppQuerySmCommand command; - @Before + @BeforeEach public void setUp() { session = mock(SMPPSession.class); config = new SmppConfiguration(); diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppReplaceSmCommandTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppReplaceSmCommandTest.java index fd69472..480fdb9 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppReplaceSmCommandTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppReplaceSmCommandTest.java @@ -29,12 +29,12 @@ import org.jsmpp.bean.RegisteredDelivery; import org.jsmpp.bean.SMSCDeliveryReceipt; import org.jsmpp.bean.TypeOfNumber; import org.jsmpp.session.SMPPSession; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.mock; @@ -48,21 +48,21 @@ public class SmppReplaceSmCommandTest { private SmppConfiguration config; private SmppReplaceSmCommand command; - @BeforeClass + @BeforeAll public static void setUpBeforeClass() { defaultTimeZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("GMT")); } - @AfterClass + @AfterAll public static void tearDownAfterClass() { if (defaultTimeZone != null) { TimeZone.setDefault(defaultTimeZone); } } - @Before + @BeforeEach public void setUp() { session = mock(SMPPSession.class); config = new SmppConfiguration(); diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppSplitterTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppSplitterTest.java index 6fd40bc..db630f0 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppSplitterTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppSplitterTest.java @@ -16,10 +16,10 @@ */ package org.apache.camel.component.smpp; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class SmppSplitterTest { diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppSubmitMultiCommandTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppSubmitMultiCommandTest.java index 974d46a..ca098f9 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppSubmitMultiCommandTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppSubmitMultiCommandTest.java @@ -41,14 +41,14 @@ import org.jsmpp.bean.SubmitMultiResult; import org.jsmpp.bean.TypeOfNumber; import org.jsmpp.bean.UnsuccessDelivery; import org.jsmpp.session.SMPPSession; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +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.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.mock; @@ -62,21 +62,21 @@ public class SmppSubmitMultiCommandTest { private SmppConfiguration config; private SmppSubmitMultiCommand command; - @BeforeClass + @BeforeAll public static void setUpBeforeClass() { defaultTimeZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("GMT")); } - @AfterClass + @AfterAll public static void tearDownAfterClass() { if (defaultTimeZone != null) { TimeZone.setDefault(defaultTimeZone); } } - @Before + @BeforeEach public void setUp() { session = mock(SMPPSession.class); config = new SmppConfiguration(); diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppSubmitSmCommandTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppSubmitSmCommandTest.java index 64eda84..4e921c2 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppSubmitSmCommandTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppSubmitSmCommandTest.java @@ -38,14 +38,15 @@ import org.jsmpp.bean.ReplaceIfPresentFlag; import org.jsmpp.bean.SMSCDeliveryReceipt; import org.jsmpp.bean.TypeOfNumber; import org.jsmpp.session.SMPPSession; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.not; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.mock; @@ -60,21 +61,21 @@ public class SmppSubmitSmCommandTest { private SmppConfiguration config; private SmppSubmitSmCommand command; - @BeforeClass + @BeforeAll public static void setUpBeforeClass() { defaultTimeZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("GMT")); } - @AfterClass + @AfterAll public static void tearDownAfterClass() { if (defaultTimeZone != null) { TimeZone.setDefault(defaultTimeZone); } } - @Before + @BeforeEach public void setUp() { session = mock(SMPPSession.class); config = new SmppConfiguration(); @@ -103,7 +104,7 @@ public class SmppSubmitSmCommandTest { } @Test - @Ignore() + @Disabled() public void executeLongBody() throws Exception { byte[] firstSM = new byte[]{5, 0, 3, 1, 2, 1, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, @@ -132,7 +133,7 @@ public class SmppSubmitSmCommandTest { assertEquals(2, exchange.getMessage().getHeader(SmppConstants.SENT_MESSAGE_COUNT)); } - @Test(expected = SmppException.class) + @Test public void executeLongBodyRejection() throws Exception { byte[] firstSM = new byte[]{5, 0, 3, 1, 2, 1, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, @@ -156,10 +157,7 @@ public class SmppSubmitSmCommandTest { eq(DataCodings.newInstance((byte) 0)), eq((byte) 0), eq(secondSM))) .thenReturn("2"); - command.execute(exchange); - - assertEquals(Arrays.asList("1", "2"), exchange.getMessage().getHeader(SmppConstants.ID)); - assertEquals(2, exchange.getMessage().getHeader(SmppConstants.SENT_MESSAGE_COUNT)); + assertThrows(SmppException.class, () -> command.execute(exchange)); } @Test diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppUcs2SplitterTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppUcs2SplitterTest.java index 1346c2c..7242929 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppUcs2SplitterTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppUcs2SplitterTest.java @@ -18,10 +18,10 @@ package org.apache.camel.component.smpp; import java.nio.charset.Charset; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class SmppUcs2SplitterTest { diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppUtilsTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppUtilsTest.java index bb46656..b85c6f6 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppUtilsTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppUtilsTest.java @@ -20,24 +20,24 @@ import java.util.Calendar; import java.util.Date; import java.util.TimeZone; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class SmppUtilsTest { private static TimeZone defaultTimeZone; - @BeforeClass + @BeforeAll public static void setUpBeforeClass() { defaultTimeZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("GMT")); } - @AfterClass + @AfterAll public static void tearDownAfterClass() { if (defaultTimeZone != null) { TimeZone.setDefault(defaultTimeZone); diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/integration/SmppComponentIntegrationTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/integration/SmppComponentIntegrationTest.java index 051f724..3b74273 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/integration/SmppComponentIntegrationTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/integration/SmppComponentIntegrationTest.java @@ -24,9 +24,13 @@ import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.component.smpp.SmppConstants; import org.apache.camel.component.smpp.SmppMessageType; -import org.apache.camel.test.junit4.CamelTestSupport; -import org.junit.Ignore; -import org.junit.Test; +import org.apache.camel.test.junit5.CamelTestSupport; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; /** * Spring based integration test for the smpp component. To run this test, ensure that @@ -38,7 +42,7 @@ import org.junit.Test; * <br/> * A SMSC for test is available here: http://www.seleniumsoftware.com/downloads.html */ -@Ignore("Must be manually tested") +@Disabled("Must be manually tested") public class SmppComponentIntegrationTest extends CamelTestSupport { @EndpointInject("mock:result") diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/integration/SmppComponentSpringIntegrationTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/integration/SmppComponentSpringIntegrationTest.java index 5dc2104..ade2069 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/integration/SmppComponentSpringIntegrationTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/integration/SmppComponentSpringIntegrationTest.java @@ -23,11 +23,15 @@ import org.apache.camel.ExchangePattern; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.component.smpp.SmppConstants; import org.apache.camel.component.smpp.SmppMessageType; -import org.apache.camel.test.spring.CamelSpringTestSupport; -import org.junit.Ignore; -import org.junit.Test; +import org.apache.camel.test.spring.junit5.CamelSpringTestSupport; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; + /** * Spring based integration test for the smpp component. To run this test, ensure that * the SMSC is running on: @@ -38,7 +42,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; * <br/> * A SMSC for test is available here: http://www.seleniumsoftware.com/downloads.html */ -@Ignore("Must be manually tested") +@Disabled("Must be manually tested") public class SmppComponentSpringIntegrationTest extends CamelSpringTestSupport { @EndpointInject("mock:result") diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/integration/SmppConsumerReconnectIntegrationTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/integration/SmppConsumerReconnectIntegrationTest.java index c2b99b1..f231014 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/integration/SmppConsumerReconnectIntegrationTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/integration/SmppConsumerReconnectIntegrationTest.java @@ -17,9 +17,9 @@ package org.apache.camel.component.smpp.integration; import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.test.junit4.CamelTestSupport; -import org.junit.Ignore; -import org.junit.Test; +import org.apache.camel.test.junit5.CamelTestSupport; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; /** * Spring based integration test for the smpp component. To run this test, ensure that @@ -31,7 +31,7 @@ import org.junit.Test; * <br/> * A SMSC for test is available here: http://www.seleniumsoftware.com/downloads.html */ -@Ignore("Must be manually tested") +@Disabled("Must be manually tested") public class SmppConsumerReconnectIntegrationTest extends CamelTestSupport { @Test diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/integration/SmppProducerReconnectIntegrationTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/integration/SmppProducerReconnectIntegrationTest.java index d2fbc30..9cebd9f 100644 --- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/integration/SmppProducerReconnectIntegrationTest.java +++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/integration/SmppProducerReconnectIntegrationTest.java @@ -17,9 +17,9 @@ package org.apache.camel.component.smpp.integration; import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.test.junit4.CamelTestSupport; -import org.junit.Ignore; -import org.junit.Test; +import org.apache.camel.test.junit5.CamelTestSupport; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; /** * Spring based integration test for the smpp component. To run this test, ensure that @@ -31,7 +31,7 @@ import org.junit.Test; * <br/> * A SMSC for test is available here: http://www.seleniumsoftware.com/downloads.html */ -@Ignore("Must be manually tested") +@Disabled("Must be manually tested") public class SmppProducerReconnectIntegrationTest extends CamelTestSupport { @Test