camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pascalschumac...@apache.org
Subject [3/3] camel git commit: CAMEL-11845: Migrate easymock and powermock to mockito
Date Thu, 12 Oct 2017 21:33:25 GMT
CAMEL-11845: Migrate easymock and powermock to mockito

Migrate camel-smpp from easymock to mockito.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/22500d98
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/22500d98
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/22500d98

Branch: refs/heads/master
Commit: 22500d986103889d5fd202fe69a51b13e784752f
Parents: 71996da
Author: Pascal Schumacher <pascalschumacher@gmx.net>
Authored: Wed Oct 11 23:38:51 2017 +0200
Committer: Pascal Schumacher <pascalschumacher@gmx.net>
Committed: Thu Oct 12 20:33:18 2017 +0200

----------------------------------------------------------------------
 components/camel-smpp/pom.xml                   |   6 +-
 .../smpp/MessageReceiverListenerImplTest.java   |  67 ++++---
 .../component/smpp/SmppCancelSmCommandTest.java |  17 +-
 .../camel/component/smpp/SmppConsumerTest.java  | 105 +++++------
 .../component/smpp/SmppDataSmCommandTest.java   |  42 ++---
 .../SmppProducerLazySessionCreationTest.java    | 135 +++++++-------
 .../camel/component/smpp/SmppProducerTest.java  | 103 ++++-------
 .../component/smpp/SmppQuerySmCommandTest.java  |  24 +--
 .../smpp/SmppReplaceSmCommandTest.java          | 166 +++++++-----------
 .../smpp/SmppSubmitMultiCommandTest.java        | 145 ++++++----------
 .../component/smpp/SmppSubmitSmCommandTest.java | 174 +++++++------------
 11 files changed, 383 insertions(+), 601 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/22500d98/components/camel-smpp/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-smpp/pom.xml b/components/camel-smpp/pom.xml
index 188a78c..eb7dd5a 100644
--- a/components/camel-smpp/pom.xml
+++ b/components/camel-smpp/pom.xml
@@ -72,10 +72,10 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.easymock</groupId>
-            <artifactId>easymock</artifactId>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
             <scope>test</scope>
-        </dependency>  
+        </dependency>
         <dependency>
             <groupId>org.apache.logging.log4j</groupId>
             <artifactId>log4j-api</artifactId>

http://git-wip-us.apache.org/repos/asf/camel/blob/22500d98/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/MessageReceiverListenerImplTest.java
----------------------------------------------------------------------
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 5ebb3eb..e5fcf59 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
@@ -31,12 +31,11 @@ import org.jsmpp.util.MessageId;
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertSame;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 public class MessageReceiverListenerImplTest {
     
@@ -47,9 +46,9 @@ public class MessageReceiverListenerImplTest {
     
     @Before
     public void setUp() {
-        endpoint = createMock(SmppEndpoint.class);
-        processor = createMock(Processor.class);
-        exceptionHandler = createMock(ExceptionHandler.class);
+        endpoint = mock(SmppEndpoint.class);
+        processor = mock(Processor.class);
+        exceptionHandler = mock(ExceptionHandler.class);
         
         listener = new MessageReceiverListenerImpl(endpoint, processor, exceptionHandler);
         listener.setMessageIDGenerator(new MessageIDGenerator() {
@@ -65,57 +64,51 @@ public class MessageReceiverListenerImplTest {
 
     @Test
     public void onAcceptAlertNotificationSuccess() throws Exception {
-        AlertNotification alertNotification = createMock(AlertNotification.class);
-        Exchange exchange = createMock(Exchange.class);
+        AlertNotification alertNotification = mock(AlertNotification.class);
+        Exchange exchange = mock(Exchange.class);
         
-        expect(endpoint.createOnAcceptAlertNotificationExchange(alertNotification))
-            .andReturn(exchange);
-        processor.process(exchange);
-        expect(exchange.getException()).andReturn(null);
-        
-        replay(endpoint, processor, exceptionHandler, alertNotification, exchange);
+        when(endpoint.createOnAcceptAlertNotificationExchange(alertNotification))
+            .thenReturn(exchange);
+        when(exchange.getException()).thenReturn(null);
         
         listener.onAcceptAlertNotification(alertNotification);
         
-        verify(endpoint, processor, exceptionHandler, alertNotification, exchange);
+        verify(endpoint).createOnAcceptAlertNotificationExchange(alertNotification);
+        verify(processor).process(exchange);
     }
     
     @Test
     public void onAcceptDeliverSmException() throws Exception {
-        DeliverSm deliverSm = createMock(DeliverSm.class);
-        Exchange exchange = createMock(Exchange.class);
+        DeliverSm deliverSm = mock(DeliverSm.class);
+        Exchange exchange = mock(Exchange.class);
         
-        expect(endpoint.createOnAcceptDeliverSmExchange(deliverSm))
-            .andReturn(exchange);
-        processor.process(exchange);
-        expect(exchange.getException()).andReturn(null);
+        when(endpoint.createOnAcceptDeliverSmExchange(deliverSm))
+            .thenReturn(exchange);
+        when(exchange.getException()).thenReturn(null);
 
-        replay(endpoint, processor, exceptionHandler, deliverSm, exchange);
-        
         listener.onAcceptDeliverSm(deliverSm);
         
-        verify(endpoint, processor, exceptionHandler, deliverSm, exchange);
+        verify(endpoint).createOnAcceptDeliverSmExchange(deliverSm);
+        verify(processor).process(exchange);
     }
     
     @Test
     public void onAcceptDataSmSuccess() throws Exception {
-        SMPPSession session = createMock(SMPPSession.class);
-        DataSm dataSm = createMock(DataSm.class);
-        Exchange exchange = createMock(Exchange.class);
+        SMPPSession session = mock(SMPPSession.class);
+        DataSm dataSm = mock(DataSm.class);
+        Exchange exchange = mock(Exchange.class);
         OptionalParameter[] optionalParameters = new OptionalParameter[]{};
         
-        expect(endpoint.createOnAcceptDataSm(dataSm, "1"))
-            .andReturn(exchange);
-        processor.process(exchange);
-        expect(exchange.getException()).andReturn(null);
-        expect(dataSm.getOptionalParameters())
-            .andReturn(optionalParameters);
-        
-        replay(endpoint, processor, exceptionHandler, session, dataSm, exchange);
+        when(endpoint.createOnAcceptDataSm(dataSm, "1"))
+            .thenReturn(exchange);
+        when(exchange.getException()).thenReturn(null);
+        when(dataSm.getOptionalParameters())
+            .thenReturn(optionalParameters);
         
         DataSmResult result = listener.onAcceptDataSm(dataSm, session);
         
-        verify(endpoint, processor, exceptionHandler, session, dataSm, exchange);
+        verify(endpoint).createOnAcceptDataSm(dataSm, "1");
+        verify(processor).process(exchange);
         
         assertEquals("1", result.getMessageId());
         assertSame(optionalParameters, result.getOptionalParameters());

http://git-wip-us.apache.org/repos/asf/camel/blob/22500d98/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppCancelSmCommandTest.java
----------------------------------------------------------------------
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 484c0e5..584044e 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
@@ -26,10 +26,9 @@ import org.jsmpp.session.SMPPSession;
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
 import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
 
 public class SmppCancelSmCommandTest {
 
@@ -39,7 +38,7 @@ public class SmppCancelSmCommandTest {
     
     @Before
     public void setUp() {
-        session = createMock(SMPPSession.class);
+        session = mock(SMPPSession.class);
         config = new SmppConfiguration();
         
         command = new SmppCancelSmCommand(session, config);
@@ -50,13 +49,10 @@ public class SmppCancelSmCommandTest {
         Exchange exchange = new DefaultExchange(new DefaultCamelContext(), ExchangePattern.InOut);
         exchange.getIn().setHeader(SmppConstants.COMMAND, "CancelSm");
         exchange.getIn().setHeader(SmppConstants.ID, "1");
-        session.cancelShortMessage("CMT", "1", TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, "1616", TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, "1717");
-        
-        replay(session);
         
         command.execute(exchange);
         
-        verify(session);
+        verify(session).cancelShortMessage("CMT", "1", TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, "1616", TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, "1717");
         
         assertEquals("1", exchange.getOut().getHeader(SmppConstants.ID));
     }
@@ -73,13 +69,10 @@ public class SmppCancelSmCommandTest {
         exchange.getIn().setHeader(SmppConstants.DEST_ADDR_TON, TypeOfNumber.INTERNATIONAL.value());
         exchange.getIn().setHeader(SmppConstants.DEST_ADDR_NPI, NumberingPlanIndicator.INTERNET.value());
         exchange.getIn().setHeader(SmppConstants.DEST_ADDR, "1919");
-        session.cancelShortMessage("XXX", "1", TypeOfNumber.NATIONAL, NumberingPlanIndicator.NATIONAL, "1818", TypeOfNumber.INTERNATIONAL, NumberingPlanIndicator.INTERNET, "1919");
-        
-        replay(session);
         
         command.execute(exchange);
         
-        verify(session);
+        verify(session).cancelShortMessage("XXX", "1", TypeOfNumber.NATIONAL, NumberingPlanIndicator.NATIONAL, "1818", TypeOfNumber.INTERNATIONAL, NumberingPlanIndicator.INTERNET, "1919");
         
         assertEquals("1", exchange.getOut().getHeader(SmppConstants.ID));
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/22500d98/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConsumerTest.java
----------------------------------------------------------------------
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 2d7a7fa..cd56393 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
@@ -27,8 +27,12 @@ import org.jsmpp.session.SessionStateListener;
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.easymock.EasyMock.*;
 import static org.junit.Assert.assertSame;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.reset;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 /**
  * JUnit test class for <code>org.apache.camel.component.smpp.SmppConsumer</code>
@@ -46,9 +50,9 @@ public class SmppConsumerTest {
     @Before
     public void setUp() {
         configuration = new SmppConfiguration();
-        endpoint = createMock(SmppEndpoint.class);
-        processor = createMock(Processor.class);
-        session = createMock(SMPPSession.class);
+        endpoint = mock(SmppEndpoint.class);
+        processor = mock(Processor.class);
+        session = mock(SMPPSession.class);
         
         // the construction of SmppConsumer will trigger the getCamelContext call
         consumer = new SmppConsumer(
@@ -64,48 +68,33 @@ public class SmppConsumerTest {
 
     @Test
     public void doStartShouldStartANewSmppSession() throws Exception {
-        resetToNice(endpoint, session);
-        expect(endpoint.getConnectionString())
-            .andReturn("smpp://smppclient@localhost:2775")
-            .times(2);
-        session.setEnquireLinkTimer(5000); //expectation
-        session.setTransactionTimer(10000); //expectation
-        session.addSessionStateListener(isA(SessionStateListener.class));
-        session.setMessageReceiverListener(isA(MessageReceiverListener.class)); //expectation
-        expect(session.connectAndBind(
-                "localhost",
-                new Integer(2775),
-                new BindParameter(
-                        BindType.BIND_RX,
-                        "smppclient",
-                        "password",
-                        "cp",
-                        TypeOfNumber.UNKNOWN,
-                        NumberingPlanIndicator.UNKNOWN,
-                        ""))).andReturn("1");
-        expect(endpoint.getConnectionString()).andReturn("smpp://smppclient@localhost:2775");
-     
-        
-        replay(endpoint, processor, session);
-        
+        when(endpoint.getConnectionString())
+            .thenReturn("smpp://smppclient@localhost:2775");
+        BindParameter expectedBindParameter = new BindParameter(BindType.BIND_RX,
+            "smppclient",
+            "password",
+            "cp",
+            TypeOfNumber.UNKNOWN,
+            NumberingPlanIndicator.UNKNOWN,
+            "");
+        when(session.connectAndBind("localhost", new Integer(2775), expectedBindParameter))
+            .thenReturn("1");
         
         consumer.doStart();
         
-        verify(endpoint, processor, session);
+        verify(session).setEnquireLinkTimer(5000);
+        verify(session).setTransactionTimer(10000);
+        verify(session).addSessionStateListener(isA(SessionStateListener.class));
+        verify(session).setMessageReceiverListener(isA(MessageReceiverListener.class));
+        verify(session).connectAndBind("localhost", new Integer(2775), expectedBindParameter);
     }
 
     @Test
     public void doStopShouldNotCloseTheSMPPSessionIfItIsNull() throws Exception {
-        resetToNice(endpoint, session);
-        expect(endpoint.getConnectionString())
-            .andReturn("smpp://smppclient@localhost:2775")
-            .times(3);
-        
-        replay(session, endpoint);
+        when(endpoint.getConnectionString())
+            .thenReturn("smpp://smppclient@localhost:2775");
         
         consumer.doStop();
-        
-        verify(session, endpoint);
     }
     
     @Test
@@ -113,42 +102,36 @@ public class SmppConsumerTest {
         doStartShouldStartANewSmppSession();
         reset(endpoint, processor, session);
         
-        expect(endpoint.getConnectionString())
-            .andReturn("smpp://smppclient@localhost:2775")
-            .times(3);
-        session.removeSessionStateListener(isA(SessionStateListener.class));
-        session.unbindAndClose();
-        
-        replay(session, endpoint);
+        when(endpoint.getConnectionString())
+            .thenReturn("smpp://smppclient@localhost:2775");
         
         consumer.doStop();
         
-        verify(session, endpoint);
+        verify(session).removeSessionStateListener(isA(SessionStateListener.class));
+        verify(session).unbindAndClose();
     }
 
     @Test
     public void addressRangeFromConfigurationIsUsed() throws Exception {
-        resetToNice(endpoint, session);
-
         configuration.setAddressRange("(111*|222*|333*)");
-
-        expect(session.connectAndBind(
-                "localhost",
+        BindParameter expectedBindParameter = new BindParameter(
+            BindType.BIND_RX,
+            "smppclient",
+            "password",
+            "cp",
+            TypeOfNumber.UNKNOWN,
+            NumberingPlanIndicator.UNKNOWN,
+            "(111*|222*|333*)");
+        when(session.connectAndBind("localhost",
                 new Integer(2775),
-                new BindParameter(
-                        BindType.BIND_RX,
-                        "smppclient",
-                        "password",
-                        "cp",
-                        TypeOfNumber.UNKNOWN,
-                        NumberingPlanIndicator.UNKNOWN,
-                        "(111*|222*|333*)"))).andReturn("1");
-
-        replay(endpoint, processor, session);
+                expectedBindParameter))
+            .thenReturn("1");
 
         consumer.doStart();
 
-        verify(endpoint, processor, session);
+        verify(session).connectAndBind("localhost",
+                new Integer(2775),
+                expectedBindParameter);
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/camel/blob/22500d98/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppDataSmCommandTest.java
----------------------------------------------------------------------
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 6621566..894c076 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
@@ -40,14 +40,12 @@ import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 public class SmppDataSmCommandTest {
 
@@ -73,7 +71,7 @@ public class SmppDataSmCommandTest {
 
     @Before
     public void setUp() {
-        session = createMock(SMPPSession.class);
+        session = mock(SMPPSession.class);
         config = new SmppConfiguration();
 
         command = new SmppDataSmCommand(session, config);
@@ -83,17 +81,13 @@ public class SmppDataSmCommandTest {
     public void executeWithConfigurationData() throws Exception {
         Exchange exchange = new DefaultExchange(new DefaultCamelContext(), ExchangePattern.InOut);
         exchange.getIn().setHeader(SmppConstants.COMMAND, "DataSm");
-        expect(session.dataShortMessage(eq("CMT"), eq(TypeOfNumber.UNKNOWN), eq(NumberingPlanIndicator.UNKNOWN), eq("1616"),
+        when(session.dataShortMessage(eq("CMT"), eq(TypeOfNumber.UNKNOWN), eq(NumberingPlanIndicator.UNKNOWN), eq("1616"),
                 eq(TypeOfNumber.UNKNOWN), eq(NumberingPlanIndicator.UNKNOWN), eq("1717"), eq(new ESMClass()),
                 eq(new RegisteredDelivery((byte) 1)), eq(DataCodings.newInstance((byte) 0))))
-            .andReturn(new DataSmResult(new MessageId("1"), null));
-
-        replay(session);
+            .thenReturn(new DataSmResult(new MessageId("1"), null));
 
         command.execute(exchange);
 
-        verify(session);
-
         assertEquals("1", exchange.getOut().getHeader(SmppConstants.ID));
         assertNull(exchange.getOut().getHeader(SmppConstants.OPTIONAL_PARAMETERS));
     }
@@ -110,17 +104,13 @@ public class SmppDataSmCommandTest {
         exchange.getIn().setHeader(SmppConstants.DEST_ADDR_NPI, NumberingPlanIndicator.INTERNET.value());
         exchange.getIn().setHeader(SmppConstants.DEST_ADDR, "1919");
         exchange.getIn().setHeader(SmppConstants.REGISTERED_DELIVERY, new RegisteredDelivery(SMSCDeliveryReceipt.FAILURE).value());
-        expect(session.dataShortMessage(eq("XXX"), eq(TypeOfNumber.NATIONAL), eq(NumberingPlanIndicator.NATIONAL), eq("1818"),
+        when(session.dataShortMessage(eq("XXX"), eq(TypeOfNumber.NATIONAL), eq(NumberingPlanIndicator.NATIONAL), eq("1818"),
                 eq(TypeOfNumber.INTERNATIONAL), eq(NumberingPlanIndicator.INTERNET), eq("1919"), eq(new ESMClass()),
                 eq(new RegisteredDelivery((byte) 2)), eq(DataCodings.newInstance((byte) 0))))
-            .andReturn(new DataSmResult(new MessageId("1"), null));
-
-        replay(session);
+            .thenReturn(new DataSmResult(new MessageId("1"), null));
 
         command.execute(exchange);
 
-        verify(session);
-
         assertEquals("1", exchange.getOut().getHeader(SmppConstants.ID));
         assertNull(exchange.getOut().getHeader(SmppConstants.OPTIONAL_PARAMETERS));
     }
@@ -145,7 +135,7 @@ public class SmppDataSmCommandTest {
         optionalParameters.put("0x2154", "7400000");
         optionalParameters.put("0x2155", null);
         exchange.getIn().setHeader(SmppConstants.OPTIONAL_PARAMETERS, optionalParameters);
-        expect(session.dataShortMessage(eq("CMT"), eq(TypeOfNumber.UNKNOWN), eq(NumberingPlanIndicator.UNKNOWN), eq("1616"),
+        when(session.dataShortMessage(eq("CMT"), eq(TypeOfNumber.UNKNOWN), eq(NumberingPlanIndicator.UNKNOWN), eq("1616"),
                 eq(TypeOfNumber.UNKNOWN), eq(NumberingPlanIndicator.UNKNOWN), eq("1717"), eq(new ESMClass()),
                 eq(new RegisteredDelivery((byte) 1)), eq(DataCodings.newInstance((byte) 0)),
                 eq(new OptionalParameter.Source_subaddress("1292".getBytes())),
@@ -154,19 +144,15 @@ public class SmppDataSmCommandTest {
                 eq(new OptionalParameter.Dest_telematics_id((short) 2)),
                 eq(new OptionalParameter.Qos_time_to_live(3600000)),
                 eq(new OptionalParameter.Alert_on_message_delivery((byte) 0))))
-            .andReturn(new DataSmResult(new MessageId("1"), new OptionalParameter[] {new OptionalParameter.Source_subaddress("1292".getBytes()),
+            .thenReturn(new DataSmResult(new MessageId("1"), new OptionalParameter[] {new OptionalParameter.Source_subaddress("1292".getBytes()),
                 new OptionalParameter.Additional_status_info_text("urgent"),
                 new OptionalParameter.Dest_addr_subunit((byte) 4),
                 new OptionalParameter.Dest_telematics_id((short) 2),
                 new OptionalParameter.Qos_time_to_live(3600000),
                 new OptionalParameter.Alert_on_message_delivery((byte) 0)}));
 
-        replay(session);
-
         command.execute(exchange);
 
-        verify(session);
-
         assertEquals(3, exchange.getOut().getHeaders().size());
         assertEquals("1", exchange.getOut().getHeader(SmppConstants.ID));
 
@@ -210,7 +196,7 @@ public class SmppDataSmCommandTest {
         optionalParameters.put(Short.valueOf((short) 0x2154), Integer.valueOf(7400000));
         optionalParameters.put(Short.valueOf((short) 0x2155), null);
         exchange.getIn().setHeader(SmppConstants.OPTIONAL_PARAMETER, optionalParameters);
-        expect(session.dataShortMessage(eq("CMT"), eq(TypeOfNumber.UNKNOWN), eq(NumberingPlanIndicator.UNKNOWN), eq("1616"),
+        when(session.dataShortMessage(eq("CMT"), eq(TypeOfNumber.UNKNOWN), eq(NumberingPlanIndicator.UNKNOWN), eq("1616"),
                 eq(TypeOfNumber.UNKNOWN), eq(NumberingPlanIndicator.UNKNOWN), eq("1717"), eq(new ESMClass()),
                 eq(new RegisteredDelivery((byte) 1)), eq(DataCodings.newInstance((byte) 0)),
                 eq(new OptionalParameter.OctetString(Tag.SOURCE_SUBADDRESS, "1292")),
@@ -225,17 +211,13 @@ public class SmppDataSmCommandTest {
                 eq(new OptionalParameter.Short((short) 0x2153, (short) 9)),
                 eq(new OptionalParameter.Int((short) 0x2154, 7400000)),
                 eq(new OptionalParameter.Null((short) 0x2155))))
-            .andReturn(new DataSmResult(new MessageId("1"), new OptionalParameter[]{
+            .thenReturn(new DataSmResult(new MessageId("1"), new OptionalParameter[]{
                 new OptionalParameter.Source_subaddress("1292".getBytes()), new OptionalParameter.Additional_status_info_text("urgent"),
                 new OptionalParameter.Dest_addr_subunit((byte) 4), new OptionalParameter.Dest_telematics_id((short) 2),
                 new OptionalParameter.Qos_time_to_live(3600000), new OptionalParameter.Alert_on_message_delivery((byte) 0)}));
 
-        replay(session);
-
         command.execute(exchange);
 
-        verify(session);
-
         assertEquals(3, exchange.getOut().getHeaders().size());
         assertEquals("1", exchange.getOut().getHeader(SmppConstants.ID));
 

http://git-wip-us.apache.org/repos/asf/camel/blob/22500d98/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppProducerLazySessionCreationTest.java
----------------------------------------------------------------------
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 d943a00..9afd28b 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
@@ -27,11 +27,11 @@ import org.jsmpp.session.SessionStateListener;
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.isA;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+import static org.mockito.Mockito.when;
 
 /**
  * JUnit test class for <code>org.apache.camel.component.smpp.SmppProducer</code>
@@ -49,8 +49,8 @@ public class SmppProducerLazySessionCreationTest {
     public void setUp() {
         configuration = new SmppConfiguration();
         configuration.setLazySessionCreation(true);
-        endpoint = createMock(SmppEndpoint.class);
-        session = createMock(SMPPSession.class);
+        endpoint = mock(SmppEndpoint.class);
+        session = mock(SMPPSession.class);
         
         producer = new SmppProducer(endpoint, configuration) {
             SMPPSession createSMPPSession() {
@@ -61,93 +61,80 @@ public class SmppProducerLazySessionCreationTest {
 
     @Test
     public void doStartShouldNotCreateTheSmppSession() throws Exception {
-        expect(endpoint.getConnectionString()).andReturn("smpp://smppclient@localhost:2775");
-        expect(endpoint.isSingleton()).andReturn(true);
-
-        replay(endpoint, session);
+        when(endpoint.getConnectionString()).thenReturn("smpp://smppclient@localhost:2775");
+        when(endpoint.isSingleton()).thenReturn(true);
 
         producer.doStart();
 
-        verify(endpoint, session);
+        verify(endpoint).getConnectionString();
+        verify(endpoint).isSingleton();
+        verifyNoMoreInteractions(endpoint, session);
     }
 
     @Test
     public void processShouldCreateTheSmppSession() throws Exception {
-        expect(endpoint.getConnectionString())
-            .andReturn("smpp://smppclient@localhost:2775")
-            .times(2);
-        session.setEnquireLinkTimer(5000); //expectation
-        session.setTransactionTimer(10000); //expectation
-        session.addSessionStateListener(isA(SessionStateListener.class));
-        expect(session.connectAndBind(
-            "localhost",
-            new Integer(2775),
-            new BindParameter(
-                    BindType.BIND_TX,
-                    "smppclient",
-                    "password",
-                    "cp",
-                    TypeOfNumber.UNKNOWN,
-                    NumberingPlanIndicator.UNKNOWN,
-                    ""))).andReturn("1");
-        expect(endpoint.getConnectionString()).andReturn("smpp://smppclient@localhost:2775");
-        expect(endpoint.isSingleton()).andReturn(true);
-        SmppBinding binding = createMock(SmppBinding.class);
-        Exchange exchange = createMock(Exchange.class);
-        Message in = createMock(Message.class);
-        SmppCommand command = createMock(SmppCommand.class);
-        expect(endpoint.getBinding()).andReturn(binding);
-        expect(binding.createSmppCommand(session, exchange)).andReturn(command);
-        expect(exchange.getIn()).andReturn(in);
-        expect(in.getHeader("CamelSmppSystemId", String.class)).andReturn(null);
-        expect(in.getHeader("CamelSmppPassword", String.class)).andReturn(null);
+        when(endpoint.getConnectionString())
+            .thenReturn("smpp://smppclient@localhost:2775");
+        BindParameter expectedBindParameter = new BindParameter(
+                BindType.BIND_TX,
+                "smppclient",
+                "password",
+                "cp",
+                TypeOfNumber.UNKNOWN,
+                NumberingPlanIndicator.UNKNOWN,
+                "");
+        when(session.connectAndBind("localhost", new Integer(2775), expectedBindParameter))
+            .thenReturn("1");
+        when(endpoint.isSingleton()).thenReturn(true);
+        SmppBinding binding = mock(SmppBinding.class);
+        Exchange exchange = mock(Exchange.class);
+        Message in = mock(Message.class);
+        SmppCommand command = mock(SmppCommand.class);
+        when(endpoint.getBinding()).thenReturn(binding);
+        when(binding.createSmppCommand(session, exchange)).thenReturn(command);
+        when(exchange.getIn()).thenReturn(in);
+        when(in.getHeader("CamelSmppSystemId", String.class)).thenReturn(null);
+        when(in.getHeader("CamelSmppPassword", String.class)).thenReturn(null);
         command.execute(exchange);
         
-        replay(session, endpoint, binding, exchange, in, command);
-        
         producer.doStart();
         producer.process(exchange);
         
-        verify(session, endpoint, binding, exchange, in, command);
+        verify(session).setEnquireLinkTimer(5000);
+        verify(session).setTransactionTimer(10000);
+        verify(session).addSessionStateListener(isA(SessionStateListener.class));
+        verify(session).connectAndBind("localhost", new Integer(2775), expectedBindParameter);
     }
 
     @Test
     public void processShouldCreateTheSmppSessionWithTheSystemIdAndPasswordFromTheExchange() throws Exception {
-        expect(endpoint.getConnectionString())
-            .andReturn("smpp://localhost:2775")
-            .times(2);
-        session.setEnquireLinkTimer(5000); //expectation
-        session.setTransactionTimer(10000); //expectation
-        session.addSessionStateListener(isA(SessionStateListener.class));
-        expect(session.connectAndBind(
-            "localhost",
-            new Integer(2775),
-            new BindParameter(
-                    BindType.BIND_TX,
-                    "smppclient2",
-                    "password2",
-                    "cp",
-                    TypeOfNumber.UNKNOWN,
-                    NumberingPlanIndicator.UNKNOWN,
-                    ""))).andReturn("1");
-        expect(endpoint.getConnectionString()).andReturn("smpp://localhost:2775");
-        SmppBinding binding = createMock(SmppBinding.class);
-        Exchange exchange = createMock(Exchange.class);
-        Message in = createMock(Message.class);
-        SmppCommand command = createMock(SmppCommand.class);
-        expect(endpoint.getBinding()).andReturn(binding);
-        expect(endpoint.isSingleton()).andReturn(true);
-        expect(binding.createSmppCommand(session, exchange)).andReturn(command);
-        expect(exchange.getIn()).andReturn(in);
-        expect(in.getHeader("CamelSmppSystemId", String.class)).andReturn("smppclient2");
-        expect(in.getHeader("CamelSmppPassword", String.class)).andReturn("password2");
+        when(endpoint.getConnectionString())
+            .thenReturn("smpp://localhost:2775");
+        BindParameter expectedBindParameter = new BindParameter(
+                BindType.BIND_TX,
+                "smppclient2",
+                "password2",
+                "cp",
+                TypeOfNumber.UNKNOWN,
+                NumberingPlanIndicator.UNKNOWN,
+                "");
+        when(session.connectAndBind("localhost", new Integer(2775), expectedBindParameter))
+            .thenReturn("1");
+        SmppBinding binding = mock(SmppBinding.class);
+        Exchange exchange = mock(Exchange.class);
+        Message in = mock(Message.class);
+        SmppCommand command = mock(SmppCommand.class);
+        when(endpoint.getBinding()).thenReturn(binding);
+        when(endpoint.isSingleton()).thenReturn(true);
+        when(binding.createSmppCommand(session, exchange)).thenReturn(command);
+        when(exchange.getIn()).thenReturn(in);
+        when(in.getHeader("CamelSmppSystemId", String.class)).thenReturn("smppclient2");
+        when(in.getHeader("CamelSmppPassword", String.class)).thenReturn("password2");
         command.execute(exchange);
         
-        replay(session, endpoint, binding, exchange, in, command);
-        
         producer.doStart();
         producer.process(exchange);
         
-        verify(session, endpoint, binding, exchange, in, command);
+        verify(session).connectAndBind("localhost", new Integer(2775), expectedBindParameter);
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/22500d98/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppProducerTest.java
----------------------------------------------------------------------
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 9c586bc..ff3da7b 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
@@ -16,8 +16,6 @@
  */
 package org.apache.camel.component.smpp;
 
-import java.io.IOException;
-
 import org.apache.camel.Exchange;
 import org.jsmpp.bean.BindType;
 import org.jsmpp.bean.NumberingPlanIndicator;
@@ -28,12 +26,11 @@ import org.jsmpp.session.SessionStateListener;
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.isA;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
 import static org.junit.Assert.assertSame;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 /**
  * JUnit test class for <code>org.apache.camel.component.smpp.SmppProducer</code>
@@ -50,8 +47,8 @@ public class SmppProducerTest {
     @Before
     public void setUp() {
         configuration = new SmppConfiguration();
-        endpoint = createMock(SmppEndpoint.class);
-        session = createMock(SMPPSession.class);
+        endpoint = mock(SmppEndpoint.class);
+        session = mock(SMPPSession.class);
         
         producer = new SmppProducer(endpoint, configuration) {
             SMPPSession createSMPPSession() {
@@ -60,90 +57,64 @@ public class SmppProducerTest {
         };
     }
 
-    private void doStartExpectations() throws IOException {
-        expect(endpoint.getConnectionString())
-            .andReturn("smpp://smppclient@localhost:2775")
-            .times(2);
-        session.setEnquireLinkTimer(5000); //expectation
-        session.setTransactionTimer(10000); //expectation
-        session.addSessionStateListener(isA(SessionStateListener.class));
-        expect(session.connectAndBind(
-            "localhost",
-            new Integer(2775),
-            new BindParameter(
-                    BindType.BIND_TX,
-                    "smppclient",
-                    "password",
-                    "cp",
-                    TypeOfNumber.UNKNOWN,
-                    NumberingPlanIndicator.UNKNOWN,
-                    ""))).andReturn("1");
-        expect(endpoint.getConnectionString())
-            .andReturn("smpp://smppclient@localhost:2775");
-        expect(endpoint.isSingleton()).andReturn(true);
-    }
-    
     @Test
     public void doStartShouldStartANewSmppSession() throws Exception {
-        doStartExpectations();
-    
-        replay(endpoint, session);
+        when(endpoint.getConnectionString())
+            .thenReturn("smpp://smppclient@localhost:2775");
+        BindParameter expectedBindParameters = new BindParameter(
+                BindType.BIND_TX,
+                "smppclient",
+                "password",
+                "cp",
+                TypeOfNumber.UNKNOWN,
+                NumberingPlanIndicator.UNKNOWN,
+                "");
+        when(session.connectAndBind("localhost", new Integer(2775), expectedBindParameters))
+            .thenReturn("1");
+        when(endpoint.isSingleton()).thenReturn(true);
     
         producer.doStart();
     
-        verify(endpoint, session);
+        verify(session).setEnquireLinkTimer(5000);
+        verify(session).setTransactionTimer(10000);
+        verify(session).addSessionStateListener(isA(SessionStateListener.class));
+        verify(session).connectAndBind("localhost", new Integer(2775), expectedBindParameters);
     }
 
     @Test
     public void doStopShouldNotCloseTheSMPPSessionIfItIsNull() throws Exception {
-        expect(endpoint.getConnectionString())
-            .andReturn("smpp://smppclient@localhost:2775")
-            .times(3);
-        expect(endpoint.isSingleton()).andReturn(true);
+        when(endpoint.getConnectionString())
+            .thenReturn("smpp://smppclient@localhost:2775");
+        when(endpoint.isSingleton()).thenReturn(true);
 
-        replay(session, endpoint);
-        
         producer.doStop();
-        
-        verify(session, endpoint);
     }
     
     @Test
     public void doStopShouldCloseTheSMPPSession() throws Exception {
-        doStartExpectations();
-        expect(endpoint.getConnectionString())
-            .andReturn("smpp://smppclient@localhost:2775")
-            .times(2);
-        session.removeSessionStateListener(isA(SessionStateListener.class));
-        session.unbindAndClose();
-        expect(endpoint.getConnectionString())
-            .andReturn("smpp://smppclient@localhost:2775");
-        expect(endpoint.isSingleton()).andReturn(true);
+        when(endpoint.getConnectionString())
+            .thenReturn("smpp://smppclient@localhost:2775");
+        when(endpoint.isSingleton()).thenReturn(true);
 
-        replay(session, endpoint);
-        
         producer.doStart();
         producer.doStop();
         
-        verify(session, endpoint);
+        verify(session).removeSessionStateListener(isA(SessionStateListener.class));
+        verify(session).unbindAndClose();
     }
     
     @Test
     public void processInOnlyShouldExecuteTheCommand() throws Exception {
-        doStartExpectations();
-        SmppBinding binding = createMock(SmppBinding.class);
-        Exchange exchange = createMock(Exchange.class);
-        SmppCommand command = createMock(SmppCommand.class);
-        expect(endpoint.getBinding()).andReturn(binding);
-        expect(binding.createSmppCommand(session, exchange)).andReturn(command);
-        command.execute(exchange);
-        
-        replay(session, endpoint, binding, exchange, command);
+        SmppBinding binding = mock(SmppBinding.class);
+        Exchange exchange = mock(Exchange.class);
+        SmppCommand command = mock(SmppCommand.class);
+        when(endpoint.getBinding()).thenReturn(binding);
+        when(binding.createSmppCommand(session, exchange)).thenReturn(command);
         
         producer.doStart();
         producer.process(exchange);
         
-        verify(session, endpoint, binding, exchange, command);
+        verify(command).execute(exchange);
     }
     
     @Test

http://git-wip-us.apache.org/repos/asf/camel/blob/22500d98/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppQuerySmCommandTest.java
----------------------------------------------------------------------
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 8461423..f4b5846 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
@@ -28,12 +28,10 @@ import org.jsmpp.session.SMPPSession;
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 public class SmppQuerySmCommandTest {
 
@@ -43,7 +41,7 @@ public class SmppQuerySmCommandTest {
     
     @Before
     public void setUp() {
-        session = createMock(SMPPSession.class);
+        session = mock(SMPPSession.class);
         config = new SmppConfiguration();
         
         command = new SmppQuerySmCommand(session, config);
@@ -54,15 +52,11 @@ public class SmppQuerySmCommandTest {
         Exchange exchange = new DefaultExchange(new DefaultCamelContext(), ExchangePattern.InOut);
         exchange.getIn().setHeader(SmppConstants.COMMAND, "QuerySm");
         exchange.getIn().setHeader(SmppConstants.ID, "1");
-        expect(session.queryShortMessage("1", TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, "1616"))
-                .andReturn(new QuerySmResult("-300101010000004+", MessageState.DELIVERED, (byte) 0));
-        
-        replay(session);
+        when(session.queryShortMessage("1", TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, "1616"))
+                .thenReturn(new QuerySmResult("-300101010000004+", MessageState.DELIVERED, (byte) 0));
         
         command.execute(exchange);
         
-        verify(session);
-        
         assertEquals("1", exchange.getOut().getHeader(SmppConstants.ID));
         assertEquals("DELIVERED", exchange.getOut().getHeader(SmppConstants.MESSAGE_STATE));
         assertEquals((byte) 0, exchange.getOut().getHeader(SmppConstants.ERROR));
@@ -77,15 +71,11 @@ public class SmppQuerySmCommandTest {
         exchange.getIn().setHeader(SmppConstants.SOURCE_ADDR_TON, TypeOfNumber.NATIONAL.value());
         exchange.getIn().setHeader(SmppConstants.SOURCE_ADDR_NPI, NumberingPlanIndicator.NATIONAL.value());
         exchange.getIn().setHeader(SmppConstants.SOURCE_ADDR, "1818");
-        expect(session.queryShortMessage("1", TypeOfNumber.NATIONAL, NumberingPlanIndicator.NATIONAL, "1818"))
-                .andReturn(new QuerySmResult("-300101010000004+", MessageState.DELIVERED, (byte) 0));
-        
-        replay(session);
+        when(session.queryShortMessage("1", TypeOfNumber.NATIONAL, NumberingPlanIndicator.NATIONAL, "1818"))
+                .thenReturn(new QuerySmResult("-300101010000004+", MessageState.DELIVERED, (byte) 0));
         
         command.execute(exchange);
         
-        verify(session);
-        
         assertEquals("1", exchange.getOut().getHeader(SmppConstants.ID));
         assertEquals("DELIVERED", exchange.getOut().getHeader(SmppConstants.MESSAGE_STATE));
         assertEquals((byte) 0, exchange.getOut().getHeader(SmppConstants.ERROR));

http://git-wip-us.apache.org/repos/asf/camel/blob/22500d98/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppReplaceSmCommandTest.java
----------------------------------------------------------------------
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 bec6d96..8d8a6fa 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
@@ -34,13 +34,11 @@ import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import static org.easymock.EasyMock.aryEq;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.isNull;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
 import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Matchers.isNull;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
 
 public class SmppReplaceSmCommandTest {
     
@@ -66,7 +64,7 @@ public class SmppReplaceSmCommandTest {
     
     @Before
     public void setUp() {
-        session = createMock(SMPPSession.class);
+        session = mock(SMPPSession.class);
         config = new SmppConfiguration();
         
         command = new SmppReplaceSmCommand(session, config);
@@ -78,14 +76,11 @@ public class SmppReplaceSmCommandTest {
         exchange.getIn().setHeader(SmppConstants.COMMAND, "ReplaceSm");
         exchange.getIn().setHeader(SmppConstants.ID, "1");
         exchange.getIn().setBody("new short message body");
-        session.replaceShortMessage(eq("1"), eq(TypeOfNumber.UNKNOWN), eq(NumberingPlanIndicator.UNKNOWN), eq("1616"), (String) isNull(), (String) isNull(),
-                eq(new RegisteredDelivery(SMSCDeliveryReceipt.SUCCESS_FAILURE)), eq((byte) 0), aryEq("new short message body".getBytes()));
-        
-        replay(session);
         
         command.execute(exchange);
         
-        verify(session);
+        verify(session).replaceShortMessage(eq("1"), eq(TypeOfNumber.UNKNOWN), eq(NumberingPlanIndicator.UNKNOWN), eq("1616"), (String) isNull(), (String) isNull(),
+                eq(new RegisteredDelivery(SMSCDeliveryReceipt.SUCCESS_FAILURE)), eq((byte) 0), eq("new short message body".getBytes()));
         
         assertEquals("1", exchange.getOut().getHeader(SmppConstants.ID));
     }
@@ -102,14 +97,11 @@ public class SmppReplaceSmCommandTest {
         exchange.getIn().setHeader(SmppConstants.VALIDITY_PERIOD, new Date(2222222));
         exchange.getIn().setHeader(SmppConstants.REGISTERED_DELIVERY, new RegisteredDelivery(SMSCDeliveryReceipt.FAILURE).value());
         exchange.getIn().setBody("new short message body");
-        session.replaceShortMessage(eq("1"), eq(TypeOfNumber.NATIONAL), eq(NumberingPlanIndicator.NATIONAL), eq("1818"), eq("-300101001831100+"), eq("-300101003702200+"),
-                eq(new RegisteredDelivery(SMSCDeliveryReceipt.FAILURE)), eq((byte) 0), aryEq("new short message body".getBytes()));
-        
-        replay(session);
         
         command.execute(exchange);
         
-        verify(session);
+        verify(session).replaceShortMessage(eq("1"), eq(TypeOfNumber.NATIONAL), eq(NumberingPlanIndicator.NATIONAL), eq("1818"), eq("-300101001831100+"), eq("-300101003702200+"),
+                eq(new RegisteredDelivery(SMSCDeliveryReceipt.FAILURE)), eq((byte) 0), eq("new short message body".getBytes()));
         
         assertEquals("1", exchange.getOut().getHeader(SmppConstants.ID));
     }
@@ -126,14 +118,11 @@ public class SmppReplaceSmCommandTest {
         exchange.getIn().setHeader(SmppConstants.VALIDITY_PERIOD, "000003000000000R"); // three days
         exchange.getIn().setHeader(SmppConstants.REGISTERED_DELIVERY, new RegisteredDelivery(SMSCDeliveryReceipt.FAILURE).value());
         exchange.getIn().setBody("new short message body");
-        session.replaceShortMessage(eq("1"), eq(TypeOfNumber.NATIONAL), eq(NumberingPlanIndicator.NATIONAL), eq("1818"), eq("-300101001831100+"), eq("000003000000000R"),
-                eq(new RegisteredDelivery(SMSCDeliveryReceipt.FAILURE)), eq((byte) 0), aryEq("new short message body".getBytes()));
-        
-        replay(session);
         
         command.execute(exchange);
         
-        verify(session);
+        verify(session).replaceShortMessage(eq("1"), eq(TypeOfNumber.NATIONAL), eq(NumberingPlanIndicator.NATIONAL), eq("1818"), eq("-300101001831100+"), eq("000003000000000R"),
+                eq(new RegisteredDelivery(SMSCDeliveryReceipt.FAILURE)), eq((byte) 0), eq("new short message body".getBytes()));
         
         assertEquals("1", exchange.getOut().getHeader(SmppConstants.ID));
     }
@@ -149,21 +138,17 @@ public class SmppReplaceSmCommandTest {
         exchange.getIn().setHeader(SmppConstants.DATA_CODING, dataCoding);
         exchange.getIn().setBody(body);
 
-        session.replaceShortMessage((String) isNull(),
-                                    eq(TypeOfNumber.UNKNOWN),
-                                    eq(NumberingPlanIndicator.UNKNOWN),
-                                    eq("1616"),
-                                    (String) isNull(),
-                                    (String) isNull(),
-                                    eq(new RegisteredDelivery(SMSCDeliveryReceipt.SUCCESS_FAILURE)),
-                                    eq((byte) 0),
-                                    aryEq(bodyNarrowed));
-
-        replay(session);
-        
         command.execute(exchange);
         
-        verify(session);
+        verify(session).replaceShortMessage((String) isNull(),
+                                            eq(TypeOfNumber.UNKNOWN),
+                                            eq(NumberingPlanIndicator.UNKNOWN),
+                                            eq("1616"),
+                                            (String) isNull(),
+                                            (String) isNull(),
+                                            eq(new RegisteredDelivery(SMSCDeliveryReceipt.SUCCESS_FAILURE)),
+                                            eq((byte) 0),
+                                            eq(bodyNarrowed));
     }
 
     @Test
@@ -177,21 +162,17 @@ public class SmppReplaceSmCommandTest {
         exchange.getIn().setHeader(SmppConstants.DATA_CODING, dataCoding);
         exchange.getIn().setBody(body);
 
-        session.replaceShortMessage((String) isNull(),
-                                    eq(TypeOfNumber.UNKNOWN),
-                                    eq(NumberingPlanIndicator.UNKNOWN),
-                                    eq("1616"),
-                                    (String) isNull(),
-                                    (String) isNull(),
-                                    eq(new RegisteredDelivery(SMSCDeliveryReceipt.SUCCESS_FAILURE)),
-                                    eq((byte) 0),
-                                    aryEq(bodyNarrowed));
-
-        replay(session);
-        
         command.execute(exchange);
         
-        verify(session);
+        verify(session).replaceShortMessage((String) isNull(),
+                                            eq(TypeOfNumber.UNKNOWN),
+                                            eq(NumberingPlanIndicator.UNKNOWN),
+                                            eq("1616"),
+                                            (String) isNull(),
+                                            (String) isNull(),
+                                            eq(new RegisteredDelivery(SMSCDeliveryReceipt.SUCCESS_FAILURE)),
+                                            eq((byte) 0),
+                                            eq(bodyNarrowed));
     }
 
     @Test
@@ -204,21 +185,18 @@ public class SmppReplaceSmCommandTest {
         exchange.getIn().setHeader(SmppConstants.DATA_CODING, dataCoding);
         exchange.getIn().setBody(body);
 
-        session.replaceShortMessage((String) isNull(),
-                                    eq(TypeOfNumber.UNKNOWN),
-                                    eq(NumberingPlanIndicator.UNKNOWN),
-                                    eq("1616"),
-                                    (String) isNull(),
-                                    (String) isNull(),
-                                    eq(new RegisteredDelivery(SMSCDeliveryReceipt.SUCCESS_FAILURE)),
-                                    eq((byte) 0),
-                                    aryEq(body));
-
-        replay(session);
-        
         command.execute(exchange);
         
-        verify(session);
+        verify(session).replaceShortMessage((String) isNull(),
+                                            eq(TypeOfNumber.UNKNOWN),
+                                            eq(NumberingPlanIndicator.UNKNOWN),
+                                            eq("1616"),
+                                            (String) isNull(),
+                                            (String) isNull(),
+                                            eq(new RegisteredDelivery(SMSCDeliveryReceipt.SUCCESS_FAILURE)),
+                                            eq((byte) 0),
+                                            eq(body));
+
     }
 
     @Test
@@ -231,21 +209,17 @@ public class SmppReplaceSmCommandTest {
         exchange.getIn().setHeader(SmppConstants.DATA_CODING, dataCoding);
         exchange.getIn().setBody(body);
 
-        session.replaceShortMessage((String) isNull(),
-                                    eq(TypeOfNumber.UNKNOWN),
-                                    eq(NumberingPlanIndicator.UNKNOWN),
-                                    eq("1616"),
-                                    (String) isNull(),
-                                    (String) isNull(),
-                                    eq(new RegisteredDelivery(SMSCDeliveryReceipt.SUCCESS_FAILURE)),
-                                    eq((byte) 0),
-                                    aryEq(body));
-
-        replay(session);
-        
         command.execute(exchange);
         
-        verify(session);
+        verify(session).replaceShortMessage((String) isNull(),
+                                            eq(TypeOfNumber.UNKNOWN),
+                                            eq(NumberingPlanIndicator.UNKNOWN),
+                                            eq("1616"),
+                                            (String) isNull(),
+                                            (String) isNull(),
+                                            eq(new RegisteredDelivery(SMSCDeliveryReceipt.SUCCESS_FAILURE)),
+                                            eq((byte) 0),
+                                            eq(body));
     }
 
     @Test
@@ -259,21 +233,17 @@ public class SmppReplaceSmCommandTest {
         exchange.getIn().setHeader(SmppConstants.DATA_CODING, binDataCoding);
         exchange.getIn().setBody(body);
 
-        session.replaceShortMessage((String) isNull(),
-                                    eq(TypeOfNumber.UNKNOWN),
-                                    eq(NumberingPlanIndicator.UNKNOWN),
-                                    eq("1616"),
-                                    (String) isNull(),
-                                    (String) isNull(),
-                                    eq(new RegisteredDelivery(SMSCDeliveryReceipt.SUCCESS_FAILURE)),
-                                    eq((byte) 0),
-                                    aryEq(body));
-
-        replay(session);
-        
         command.execute(exchange);
         
-        verify(session);
+        verify(session).replaceShortMessage((String) isNull(),
+                                            eq(TypeOfNumber.UNKNOWN),
+                                            eq(NumberingPlanIndicator.UNKNOWN),
+                                            eq("1616"),
+                                            (String) isNull(),
+                                            (String) isNull(),
+                                            eq(new RegisteredDelivery(SMSCDeliveryReceipt.SUCCESS_FAILURE)),
+                                            eq((byte) 0),
+                                            eq(body));
     }
 
     @Test
@@ -289,20 +259,16 @@ public class SmppReplaceSmCommandTest {
         exchange.getIn().setHeader(SmppConstants.DATA_CODING, latin1DataCoding);
         exchange.getIn().setBody(body);
 
-        session.replaceShortMessage((String) isNull(),
-                                    eq(TypeOfNumber.UNKNOWN),
-                                    eq(NumberingPlanIndicator.UNKNOWN),
-                                    eq("1616"),
-                                    (String) isNull(),
-                                    (String) isNull(),
-                                    eq(new RegisteredDelivery(SMSCDeliveryReceipt.SUCCESS_FAILURE)),
-                                    eq((byte) 0),
-                                    aryEq(bodyNarrowed));
-
-        replay(session);
-        
         command.execute(exchange);
         
-        verify(session);
+        verify(session).replaceShortMessage((String) isNull(),
+                                            eq(TypeOfNumber.UNKNOWN),
+                                            eq(NumberingPlanIndicator.UNKNOWN),
+                                            eq("1616"),
+                                            (String) isNull(),
+                                            (String) isNull(),
+                                            eq(new RegisteredDelivery(SMSCDeliveryReceipt.SUCCESS_FAILURE)),
+                                            eq((byte) 0),
+                                            eq(bodyNarrowed));
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/22500d98/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppSubmitMultiCommandTest.java
----------------------------------------------------------------------
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 ee1b216..d9b1a35 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
@@ -45,16 +45,13 @@ import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import static org.easymock.EasyMock.aryEq;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.isNull;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Matchers.isNull;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 public class SmppSubmitMultiCommandTest {
 
@@ -80,7 +77,7 @@ public class SmppSubmitMultiCommandTest {
 
     @Before
     public void setUp() {
-        session = createMock(SMPPSession.class);
+        session = mock(SMPPSession.class);
         config = new SmppConfiguration();
         
         command = new SmppSubmitMultiCommand(session, config);
@@ -92,18 +89,14 @@ public class SmppSubmitMultiCommandTest {
         exchange.getIn().setHeader(SmppConstants.COMMAND, "SubmitMulti");
         exchange.getIn().setHeader(SmppConstants.ID, "1");
         exchange.getIn().setBody("short message body");
-        expect(session.submitMultiple(eq("CMT"), eq(TypeOfNumber.UNKNOWN), eq(NumberingPlanIndicator.UNKNOWN), eq("1616"),
-                aryEq(new Address[]{new Address(TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, "1717")}),
+        when(session.submitMultiple(eq("CMT"), eq(TypeOfNumber.UNKNOWN), eq(NumberingPlanIndicator.UNKNOWN), eq("1616"),
+                eq(new Address[]{new Address(TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, "1717")}),
                 eq(new ESMClass()), eq((byte) 0), eq((byte) 1), (String) isNull(), (String) isNull(), eq(new RegisteredDelivery(SMSCDeliveryReceipt.SUCCESS_FAILURE)),
-                eq(ReplaceIfPresentFlag.DEFAULT), eq(DataCodings.newInstance((byte) 0)), eq((byte) 0), aryEq("short message body".getBytes())))
-                .andReturn(new SubmitMultiResult("1", new UnsuccessDelivery(new Address(TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, "1717"), 0)));
-
-        replay(session);
+                eq(ReplaceIfPresentFlag.DEFAULT), eq(DataCodings.newInstance((byte) 0)), eq((byte) 0), eq("short message body".getBytes())))
+                .thenReturn(new SubmitMultiResult("1", new UnsuccessDelivery(new Address(TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, "1717"), 0)));
 
         command.execute(exchange);
 
-        verify(session);
-
         assertEquals(Arrays.asList("1"), exchange.getOut().getHeader(SmppConstants.ID));
         assertEquals(1, exchange.getOut().getHeader(SmppConstants.SENT_MESSAGE_COUNT));
         assertNotNull(exchange.getOut().getHeader(SmppConstants.ERROR));
@@ -127,18 +120,14 @@ public class SmppSubmitMultiCommandTest {
         exchange.getIn().setHeader(SmppConstants.REGISTERED_DELIVERY, new RegisteredDelivery(SMSCDeliveryReceipt.FAILURE).value());
         exchange.getIn().setHeader(SmppConstants.REPLACE_IF_PRESENT_FLAG, ReplaceIfPresentFlag.REPLACE.value());
         exchange.getIn().setBody("short message body");
-        expect(session.submitMultiple(eq("CMT"), eq(TypeOfNumber.NATIONAL), eq(NumberingPlanIndicator.NATIONAL), eq("1818"),
-                aryEq(new Address[]{new Address(TypeOfNumber.INTERNATIONAL, NumberingPlanIndicator.INTERNET, "1919")}),
+        when(session.submitMultiple(eq("CMT"), eq(TypeOfNumber.NATIONAL), eq(NumberingPlanIndicator.NATIONAL), eq("1818"),
+                eq(new Address[]{new Address(TypeOfNumber.INTERNATIONAL, NumberingPlanIndicator.INTERNET, "1919")}),
                 eq(new ESMClass()), eq((byte) 1), eq((byte) 2), eq("-300101001831100+"), eq("-300101003702200+"), eq(new RegisteredDelivery(SMSCDeliveryReceipt.FAILURE)),
-                eq(ReplaceIfPresentFlag.REPLACE), eq(DataCodings.newInstance((byte) 0)), eq((byte) 0), aryEq("short message body".getBytes())))
-                .andReturn(new SubmitMultiResult("1"));
-
-        replay(session);
+                eq(ReplaceIfPresentFlag.REPLACE), eq(DataCodings.newInstance((byte) 0)), eq((byte) 0), eq("short message body".getBytes())))
+                .thenReturn(new SubmitMultiResult("1"));
 
         command.execute(exchange);
 
-        verify(session);
-
         assertEquals(Arrays.asList("1"), exchange.getOut().getHeader(SmppConstants.ID));
         assertEquals(1, exchange.getOut().getHeader(SmppConstants.SENT_MESSAGE_COUNT));
         assertNull(exchange.getOut().getHeader(SmppConstants.ERROR));
@@ -162,18 +151,14 @@ public class SmppSubmitMultiCommandTest {
         exchange.getIn().setHeader(SmppConstants.REGISTERED_DELIVERY, new RegisteredDelivery(SMSCDeliveryReceipt.FAILURE).value());
         exchange.getIn().setHeader(SmppConstants.REPLACE_IF_PRESENT_FLAG, ReplaceIfPresentFlag.REPLACE.value());
         exchange.getIn().setBody("short message body");
-        expect(session.submitMultiple(eq("CMT"), eq(TypeOfNumber.NATIONAL), eq(NumberingPlanIndicator.NATIONAL), eq("1818"),
-                aryEq(new Address[]{new Address(TypeOfNumber.INTERNATIONAL, NumberingPlanIndicator.INTERNET, "1919")}),
+        when(session.submitMultiple(eq("CMT"), eq(TypeOfNumber.NATIONAL), eq(NumberingPlanIndicator.NATIONAL), eq("1818"),
+                eq(new Address[]{new Address(TypeOfNumber.INTERNATIONAL, NumberingPlanIndicator.INTERNET, "1919")}),
                 eq(new ESMClass()), eq((byte) 1), eq((byte) 2), eq("-300101001831100+"), eq("000003000000000R"), eq(new RegisteredDelivery(SMSCDeliveryReceipt.FAILURE)),
-                eq(ReplaceIfPresentFlag.REPLACE), eq(DataCodings.newInstance((byte) 0)), eq((byte) 0), aryEq("short message body".getBytes())))
-                .andReturn(new SubmitMultiResult("1"));
-
-        replay(session);
+                eq(ReplaceIfPresentFlag.REPLACE), eq(DataCodings.newInstance((byte) 0)), eq((byte) 0), eq("short message body".getBytes())))
+                .thenReturn(new SubmitMultiResult("1"));
 
         command.execute(exchange);
 
-        verify(session);
-
         assertEquals(Arrays.asList("1"), exchange.getOut().getHeader(SmppConstants.ID));
         assertEquals(1, exchange.getOut().getHeader(SmppConstants.SENT_MESSAGE_COUNT));
         assertNull(exchange.getOut().getHeader(SmppConstants.ERROR));
@@ -195,11 +180,11 @@ public class SmppSubmitMultiCommandTest {
                         "1717")
         };
 
-        expect(session.submitMultiple(eq("CMT"),
+        when(session.submitMultiple(eq("CMT"),
                                       eq(TypeOfNumber.UNKNOWN),
                                       eq(NumberingPlanIndicator.UNKNOWN),
                                       eq("1616"),
-                                      aryEq(destAddrs),
+                                      eq(destAddrs),
                                       eq(new ESMClass()),
                                       eq((byte) 0),
                                       eq((byte) 1),
@@ -209,14 +194,12 @@ public class SmppSubmitMultiCommandTest {
                                       eq(ReplaceIfPresentFlag.DEFAULT),
                                       eq(DataCodings.newInstance(dataCoding)),
                                       eq((byte) 0),
-                                      aryEq(bodyNarrowed)))
-            .andReturn(new SubmitMultiResult("1"));
-
-        replay(session);
+                                      eq(bodyNarrowed)))
+            .thenReturn(new SubmitMultiResult("1"));
 
         command.execute(exchange);
 
-        verify(session);
+        assertEquals(Arrays.asList("1"), exchange.getOut().getHeader(SmppConstants.ID));
     }
 
     @Test
@@ -235,11 +218,11 @@ public class SmppSubmitMultiCommandTest {
                         "1717")
         };
 
-        expect(session.submitMultiple(eq("CMT"),
+        when(session.submitMultiple(eq("CMT"),
                                       eq(TypeOfNumber.UNKNOWN),
                                       eq(NumberingPlanIndicator.UNKNOWN),
                                       eq("1616"),
-                                      aryEq(destAddrs),
+                                      eq(destAddrs),
                                       eq(new ESMClass()),
                                       eq((byte) 0),
                                       eq((byte) 1),
@@ -249,14 +232,12 @@ public class SmppSubmitMultiCommandTest {
                                       eq(ReplaceIfPresentFlag.DEFAULT),
                                       eq(DataCodings.newInstance(dataCoding)),
                                       eq((byte) 0),
-                                      aryEq(bodyNarrowed)))
-            .andReturn(new SubmitMultiResult("1"));
-
-        replay(session);
+                                      eq(bodyNarrowed)))
+            .thenReturn(new SubmitMultiResult("1"));
 
         command.execute(exchange);
 
-        verify(session);
+        assertEquals(Arrays.asList("1"), exchange.getOut().getHeader(SmppConstants.ID));
     }
 
     @Test
@@ -274,11 +255,11 @@ public class SmppSubmitMultiCommandTest {
                         "1717")
         };
 
-        expect(session.submitMultiple(eq("CMT"),
+        when(session.submitMultiple(eq("CMT"),
                                       eq(TypeOfNumber.UNKNOWN),
                                       eq(NumberingPlanIndicator.UNKNOWN),
                                       eq("1616"),
-                                      aryEq(destAddrs),
+                                      eq(destAddrs),
                                       eq(new ESMClass()),
                                       eq((byte) 0),
                                       eq((byte) 1),
@@ -288,14 +269,12 @@ public class SmppSubmitMultiCommandTest {
                                       eq(ReplaceIfPresentFlag.DEFAULT),
                                       eq(DataCodings.newInstance(dataCoding)),
                                       eq((byte) 0),
-                                      aryEq(body)))
-            .andReturn(new SubmitMultiResult("1"));
-
-        replay(session);
+                                      eq(body)))
+            .thenReturn(new SubmitMultiResult("1"));
 
         command.execute(exchange);
 
-        verify(session);
+        assertEquals(Arrays.asList("1"), exchange.getOut().getHeader(SmppConstants.ID));
     }
 
     @Test
@@ -313,11 +292,11 @@ public class SmppSubmitMultiCommandTest {
                         "1717")
         };
 
-        expect(session.submitMultiple(eq("CMT"),
+        when(session.submitMultiple(eq("CMT"),
                                       eq(TypeOfNumber.UNKNOWN),
                                       eq(NumberingPlanIndicator.UNKNOWN),
                                       eq("1616"),
-                                      aryEq(destAddrs),
+                                      eq(destAddrs),
                                       eq(new ESMClass()),
                                       eq((byte) 0),
                                       eq((byte) 1),
@@ -327,14 +306,12 @@ public class SmppSubmitMultiCommandTest {
                                       eq(ReplaceIfPresentFlag.DEFAULT),
                                       eq(DataCodings.newInstance(dataCoding)),
                                       eq((byte) 0),
-                                      aryEq(body)))
-            .andReturn(new SubmitMultiResult("1"));
-
-        replay(session);
+                                      eq(body)))
+            .thenReturn(new SubmitMultiResult("1"));
 
         command.execute(exchange);
 
-        verify(session);
+        assertEquals(Arrays.asList("1"), exchange.getOut().getHeader(SmppConstants.ID));
     }
 
     @Test
@@ -353,11 +330,11 @@ public class SmppSubmitMultiCommandTest {
                         "1717")
         };
 
-        expect(session.submitMultiple(eq("CMT"),
+        when(session.submitMultiple(eq("CMT"),
                                       eq(TypeOfNumber.UNKNOWN),
                                       eq(NumberingPlanIndicator.UNKNOWN),
                                       eq("1616"),
-                                      aryEq(destAddrs),
+                                      eq(destAddrs),
                                       eq(new ESMClass()),
                                       eq((byte) 0),
                                       eq((byte) 1),
@@ -367,14 +344,12 @@ public class SmppSubmitMultiCommandTest {
                                       eq(ReplaceIfPresentFlag.DEFAULT),
                                       eq(DataCodings.newInstance(binDataCoding)),
                                       eq((byte) 0),
-                                      aryEq(body)))
-            .andReturn(new SubmitMultiResult("1"));
-
-        replay(session);
+                                      eq(body)))
+            .thenReturn(new SubmitMultiResult("1"));
 
         command.execute(exchange);
 
-        verify(session);
+        assertEquals(Arrays.asList("1"), exchange.getOut().getHeader(SmppConstants.ID));
     }
 
     @Test
@@ -394,11 +369,11 @@ public class SmppSubmitMultiCommandTest {
                         "1717")
         };
 
-        expect(session.submitMultiple(eq("CMT"),
+        when(session.submitMultiple(eq("CMT"),
                                       eq(TypeOfNumber.UNKNOWN),
                                       eq(NumberingPlanIndicator.UNKNOWN),
                                       eq("1616"),
-                                      aryEq(destAddrs),
+                                      eq(destAddrs),
                                       eq(new ESMClass()),
                                       eq((byte) 0),
                                       eq((byte) 1),
@@ -408,14 +383,12 @@ public class SmppSubmitMultiCommandTest {
                                       eq(ReplaceIfPresentFlag.DEFAULT),
                                       eq(DataCodings.newInstance(latin1DataCoding)),
                                       eq((byte) 0),
-                                      aryEq(bodyNarrowed)))
-            .andReturn(new SubmitMultiResult("1"));
-
-        replay(session);
+                                      eq(bodyNarrowed)))
+            .thenReturn(new SubmitMultiResult("1"));
 
         command.execute(exchange);
 
-        verify(session);
+        assertEquals(Arrays.asList("1"), exchange.getOut().getHeader(SmppConstants.ID));
     }
 
     @Test
@@ -444,24 +417,20 @@ public class SmppSubmitMultiCommandTest {
         optionalParameters.put("ALERT_ON_MESSAGE_DELIVERY", null);
         exchange.getIn().setHeader(SmppConstants.OPTIONAL_PARAMETERS, optionalParameters);
         exchange.getIn().setBody("short message body");
-        expect(session.submitMultiple(eq("CMT"), eq(TypeOfNumber.NATIONAL), eq(NumberingPlanIndicator.NATIONAL), eq("1818"),
-                aryEq(new Address[]{new Address(TypeOfNumber.INTERNATIONAL, NumberingPlanIndicator.INTERNET, "1919")}),
+        when(session.submitMultiple(eq("CMT"), eq(TypeOfNumber.NATIONAL), eq(NumberingPlanIndicator.NATIONAL), eq("1818"),
+                eq(new Address[]{new Address(TypeOfNumber.INTERNATIONAL, NumberingPlanIndicator.INTERNET, "1919")}),
                 eq(new ESMClass()), eq((byte) 1), eq((byte) 2), eq("-300101001831100+"), eq("-300101003702200+"), eq(new RegisteredDelivery(SMSCDeliveryReceipt.FAILURE)),
-                eq(ReplaceIfPresentFlag.REPLACE), eq(DataCodings.newInstance((byte) 0)), eq((byte) 0), aryEq("short message body".getBytes()),
+                eq(ReplaceIfPresentFlag.REPLACE), eq(DataCodings.newInstance((byte) 0)), eq((byte) 0), eq("short message body".getBytes()),
                 eq(new OptionalParameter.Source_subaddress("1292".getBytes())),
                 eq(new OptionalParameter.Additional_status_info_text("urgent".getBytes())),
                 eq(new OptionalParameter.Dest_addr_subunit((byte) 4)),
                 eq(new OptionalParameter.Dest_telematics_id((short) 2)),
                 eq(new OptionalParameter.Qos_time_to_live(3600000)),
                 eq(new OptionalParameter.Alert_on_message_delivery("O".getBytes()))))
-                .andReturn(new SubmitMultiResult("1"));
-
-        replay(session);
+                .thenReturn(new SubmitMultiResult("1"));
 
         command.execute(exchange);
 
-        verify(session);
-
         assertEquals(Arrays.asList("1"), exchange.getOut().getHeader(SmppConstants.ID));
         assertEquals(1, exchange.getOut().getHeader(SmppConstants.SENT_MESSAGE_COUNT));
         assertNull(exchange.getOut().getHeader(SmppConstants.ERROR));
@@ -501,10 +470,10 @@ public class SmppSubmitMultiCommandTest {
         optionalParameters.put(Short.valueOf((short) 0x2155), null);
         exchange.getIn().setHeader(SmppConstants.OPTIONAL_PARAMETER, optionalParameters);
         exchange.getIn().setBody("short message body");
-        expect(session.submitMultiple(eq("CMT"), eq(TypeOfNumber.NATIONAL), eq(NumberingPlanIndicator.NATIONAL), eq("1818"),
-                aryEq(new Address[]{new Address(TypeOfNumber.INTERNATIONAL, NumberingPlanIndicator.INTERNET, "1919")}),
+        when(session.submitMultiple(eq("CMT"), eq(TypeOfNumber.NATIONAL), eq(NumberingPlanIndicator.NATIONAL), eq("1818"),
+                eq(new Address[]{new Address(TypeOfNumber.INTERNATIONAL, NumberingPlanIndicator.INTERNET, "1919")}),
                 eq(new ESMClass()), eq((byte) 1), eq((byte) 2), eq("-300101001831100+"), eq("-300101003702200+"), eq(new RegisteredDelivery(SMSCDeliveryReceipt.FAILURE)),
-                eq(ReplaceIfPresentFlag.REPLACE), eq(DataCodings.newInstance((byte) 0)), eq((byte) 0), aryEq("short message body".getBytes()),
+                eq(ReplaceIfPresentFlag.REPLACE), eq(DataCodings.newInstance((byte) 0)), eq((byte) 0), eq("short message body".getBytes()),
                 eq(new OptionalParameter.OctetString(Tag.SOURCE_SUBADDRESS, "1292")),
                 eq(new OptionalParameter.COctetString(Tag.ADDITIONAL_STATUS_INFO_TEXT.code(), "urgent")),
                 eq(new OptionalParameter.Byte(Tag.DEST_ADDR_SUBUNIT, (byte) 4)),
@@ -517,14 +486,10 @@ public class SmppSubmitMultiCommandTest {
                 eq(new OptionalParameter.Short((short) 0x2153, (short) 9)),
                 eq(new OptionalParameter.Int((short) 0x2154, 7400000)),
                 eq(new OptionalParameter.Null((short) 0x2155))))
-                .andReturn(new SubmitMultiResult("1"));
-
-        replay(session);
+                .thenReturn(new SubmitMultiResult("1"));
 
         command.execute(exchange);
 
-        verify(session);
-
         assertEquals(Arrays.asList("1"), exchange.getOut().getHeader(SmppConstants.ID));
         assertEquals(1, exchange.getOut().getHeader(SmppConstants.SENT_MESSAGE_COUNT));
         assertNull(exchange.getOut().getHeader(SmppConstants.ERROR));


Mime
View raw message