You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2023/06/23 11:41:12 UTC

[cxf] branch main updated: CXF-8846: Get rid of EasyMock in cxf-rt-bindings-soap (#1307)

This is an automated email from the ASF dual-hosted git repository.

reta pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/main by this push:
     new 539ec7f78a CXF-8846: Get rid of EasyMock in cxf-rt-bindings-soap (#1307)
539ec7f78a is described below

commit 539ec7f78a53e00f7a51613dd348cf17778d759d
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Fri Jun 23 07:41:07 2023 -0400

    CXF-8846: Get rid of EasyMock in cxf-rt-bindings-soap (#1307)
---
 rt/bindings/soap/pom.xml                           |  5 ++-
 .../cxf/binding/soap/RPCInInterceptorTest.java     | 19 ++++------
 .../cxf/binding/soap/RPCOutInterceptorTest.java    | 19 ++++------
 .../cxf/binding/soap/ServiceModelUtilTest.java     | 18 ++++-----
 .../cxf/binding/soap/SoapBindingFactoryTest.java   | 42 ++++++---------------
 .../java/org/apache/cxf/binding/soap/TestBase.java | 16 ++++----
 .../interceptor/SoapActionInInterceptorTest.java   | 44 ++++------------------
 .../SoapPreProtocolOutInterceptorTest.java         |  6 ---
 .../soap/jms/interceptor/SoapFaultFactoryTest.java | 33 ++++++----------
 9 files changed, 61 insertions(+), 141 deletions(-)

diff --git a/rt/bindings/soap/pom.xml b/rt/bindings/soap/pom.xml
index 35537af8b1..449261f550 100644
--- a/rt/bindings/soap/pom.xml
+++ b/rt/bindings/soap/pom.xml
@@ -105,8 +105,9 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.easymock</groupId>
-            <artifactId>easymock</artifactId>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+            <version>${cxf.mockito.version}</version>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git a/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/RPCInInterceptorTest.java b/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/RPCInInterceptorTest.java
index 1d960f4c4e..5df9226e6f 100644
--- a/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/RPCInInterceptorTest.java
+++ b/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/RPCInInterceptorTest.java
@@ -34,13 +34,13 @@ import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
 import org.junit.Before;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 public class RPCInInterceptorTest extends TestBase {
 
@@ -48,8 +48,6 @@ public class RPCInInterceptorTest extends TestBase {
 
     private static final String OPNAME = "sendReceiveData";
 
-    private IMocksControl control = EasyMock.createNiceControl();
-
     @Before
     public void setUp() throws Exception {
         super.setUp();
@@ -64,19 +62,16 @@ public class RPCInInterceptorTest extends TestBase {
         boi.getOperationInfo().getOutput().getMessagePartByIndex(0).setIndex(0);
         soapMessage.getExchange().put(BindingOperationInfo.class, boi);
 
-        control.reset();
-        Service service = control.createMock(Service.class);
+        Service service = mock(Service.class);
         JAXBDataBinding dataBinding = new JAXBDataBinding(MyComplexStruct.class);
-        service.getDataBinding();
-        EasyMock.expectLastCall().andReturn(dataBinding).anyTimes();
-        service.getServiceInfos();
+        when(service.getDataBinding()).thenReturn(dataBinding);
+
         List<ServiceInfo> list = Arrays.asList(si);
-        EasyMock.expectLastCall().andReturn(list).anyTimes();
-        EasyMock.expect(service.isEmpty()).andReturn(true).anyTimes();
+        when(service.getServiceInfos()).thenReturn(list);
+        when(service.isEmpty()).thenReturn(true);
 
         soapMessage.getExchange().put(Service.class, service);
         soapMessage.getExchange().put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.FALSE);
-        control.replay();
     }
 
     @Test
diff --git a/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/RPCOutInterceptorTest.java b/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/RPCOutInterceptorTest.java
index 028181efbb..6b9e7d528d 100644
--- a/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/RPCOutInterceptorTest.java
+++ b/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/RPCOutInterceptorTest.java
@@ -40,14 +40,14 @@ import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.staxutils.DepthXMLStreamReader;
 import org.apache.cxf.staxutils.StaxUtils;
 
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 public class RPCOutInterceptorTest extends TestBase {
 
@@ -57,8 +57,6 @@ public class RPCOutInterceptorTest extends TestBase {
 
     private ByteArrayOutputStream baos = new ByteArrayOutputStream(64 * 1024);
 
-    private IMocksControl control = EasyMock.createNiceControl();
-
     @Before
     public void setUp() throws Exception {
         super.setUp();
@@ -70,19 +68,16 @@ public class RPCOutInterceptorTest extends TestBase {
         boi.getOperationInfo().getOutput().getMessagePartByIndex(0).setIndex(0);
         soapMessage.getExchange().put(BindingOperationInfo.class, boi);
 
-        control.reset();
-        Service service = control.createMock(Service.class);
-        EasyMock.expect(service.isEmpty()).andReturn(true).anyTimes();
+        Service service = mock(Service.class);
+        when(service.isEmpty()).thenReturn(true);
         JAXBDataBinding dataBinding = new JAXBDataBinding(MyComplexStruct.class);
-        service.getDataBinding();
-        EasyMock.expectLastCall().andReturn(dataBinding).anyTimes();
-        service.getServiceInfos();
+        when(service.getDataBinding()).thenReturn(dataBinding);
+
         List<ServiceInfo> list = Arrays.asList(si);
-        EasyMock.expectLastCall().andReturn(list).anyTimes();
+        when(service.getServiceInfos()).thenReturn(list);
 
         soapMessage.getExchange().put(Service.class, service);
         soapMessage.getExchange().put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.FALSE);
-        control.replay();
 
         MyComplexStruct mcs = new MyComplexStruct();
         mcs.setElem1("elem1");
diff --git a/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/ServiceModelUtilTest.java b/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/ServiceModelUtilTest.java
index e7ec7ad215..f544e119b4 100644
--- a/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/ServiceModelUtilTest.java
+++ b/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/ServiceModelUtilTest.java
@@ -39,23 +39,21 @@ import org.apache.cxf.service.model.ServiceModelUtil;
 import org.apache.cxf.transport.DestinationFactoryManager;
 import org.apache.cxf.wsdl11.WSDLServiceBuilder;
 
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.easymock.EasyMock.expect;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 public class ServiceModelUtilTest {
     private static final String WSDL_PATH = "test-soap-header.wsdl";
     private Service service;
     private ServiceInfo serviceInfo;
 
-    private IMocksControl control;
     private Bus bus;
     private BindingFactoryManager bindingFactoryManager;
 
@@ -74,17 +72,15 @@ public class ServiceModelUtilTest {
             }
         }
 
-        control = EasyMock.createNiceControl();
-        bus = control.createMock(Bus.class);
-        bindingFactoryManager = control.createMock(BindingFactoryManager.class);
+        bus = mock(Bus.class);
+        bindingFactoryManager = mock(BindingFactoryManager.class);
         WSDLServiceBuilder wsdlServiceBuilder = new WSDLServiceBuilder(bus);
 
-        EasyMock.expect(bus.getExtension(BindingFactoryManager.class)).andReturn(bindingFactoryManager);
+        when(bus.getExtension(BindingFactoryManager.class)).thenReturn(bindingFactoryManager);
 
-        DestinationFactoryManager dfm = control.createMock(DestinationFactoryManager.class);
-        expect(bus.getExtension(DestinationFactoryManager.class)).andStubReturn(dfm);
+        DestinationFactoryManager dfm = mock(DestinationFactoryManager.class);
+        when(bus.getExtension(DestinationFactoryManager.class)).thenReturn(dfm);
 
-        control.replay();
         serviceInfo = wsdlServiceBuilder.buildServices(def, service).get(0);
     }
 
diff --git a/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapBindingFactoryTest.java b/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapBindingFactoryTest.java
index ebf4cd406c..24bd024848 100644
--- a/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapBindingFactoryTest.java
+++ b/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapBindingFactoryTest.java
@@ -46,28 +46,18 @@ import org.apache.cxf.transport.DestinationFactoryManager;
 import org.apache.cxf.wsdl.WSDLConstants;
 import org.apache.cxf.wsdl11.WSDLServiceBuilder;
 
-import org.easymock.IMocksControl;
-import org.junit.Before;
 import org.junit.Test;
 
-import static org.easymock.EasyMock.createNiceControl;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
 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.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 public class SoapBindingFactoryTest {
-    IMocksControl control;
-
-    @Before
-    public void setUp() {
-        control = createNiceControl();
-    }
-
     private Bus getMockBus() {
-        return control.createMock(Bus.class);
+        return mock(Bus.class);
     }
 
     private BindingFactoryManager getBindingFactoryManager(String ns, Bus bus) throws BusException {
@@ -84,13 +74,10 @@ public class SoapBindingFactoryTest {
 
         BindingFactoryManager bfm = getBindingFactoryManager(WSDLConstants.NS_SOAP11, bus);
 
-        bus.getExtension(BindingFactoryManager.class);
-        expectLastCall().andReturn(bfm).anyTimes();
+        when(bus.getExtension(BindingFactoryManager.class)).thenReturn(bfm);
 
-        DestinationFactoryManager dfm = control.createMock(DestinationFactoryManager.class);
-        expect(bus.getExtension(DestinationFactoryManager.class)).andStubReturn(dfm);
-
-        control.replay();
+        DestinationFactoryManager dfm = mock(DestinationFactoryManager.class);
+        when(bus.getExtension(DestinationFactoryManager.class)).thenReturn(dfm);
 
         WSDLServiceBuilder builder = new WSDLServiceBuilder(bus);
         ServiceInfo serviceInfo = builder
@@ -133,13 +120,10 @@ public class SoapBindingFactoryTest {
 
         BindingFactoryManager bfm = getBindingFactoryManager(WSDLConstants.NS_SOAP11, bus);
 
-        bus.getExtension(BindingFactoryManager.class);
-        expectLastCall().andReturn(bfm).anyTimes();
-
-        DestinationFactoryManager dfm = control.createMock(DestinationFactoryManager.class);
-        expect(bus.getExtension(DestinationFactoryManager.class)).andStubReturn(dfm);
+        when(bus.getExtension(BindingFactoryManager.class)).thenReturn(bfm);
 
-        control.replay();
+        DestinationFactoryManager dfm = mock(DestinationFactoryManager.class);
+        when(bus.getExtension(DestinationFactoryManager.class)).thenReturn(dfm);
 
         WSDLServiceBuilder builder = new WSDLServiceBuilder(bus);
         ServiceInfo serviceInfo = builder
@@ -180,12 +164,10 @@ public class SoapBindingFactoryTest {
 
         BindingFactoryManager bfm = getBindingFactoryManager(WSDLConstants.NS_SOAP12, bus);
 
-        expect(bus.getExtension(BindingFactoryManager.class)).andReturn(bfm);
-
-        DestinationFactoryManager dfm = control.createMock(DestinationFactoryManager.class);
-        expect(bus.getExtension(DestinationFactoryManager.class)).andStubReturn(dfm);
+        when(bus.getExtension(BindingFactoryManager.class)).thenReturn(bfm);
 
-        control.replay();
+        DestinationFactoryManager dfm = mock(DestinationFactoryManager.class);
+        when(bus.getExtension(DestinationFactoryManager.class)).thenReturn(dfm);
 
         WSDLServiceBuilder builder = new WSDLServiceBuilder(bus);
         ServiceInfo serviceInfo = builder
diff --git a/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/TestBase.java b/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/TestBase.java
index e847964761..52c97dbd1f 100644
--- a/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/TestBase.java
+++ b/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/TestBase.java
@@ -45,12 +45,12 @@ import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.transport.DestinationFactoryManager;
 import org.apache.cxf.wsdl11.WSDLServiceBuilder;
 
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
 import org.junit.After;
 import org.junit.Before;
 
 import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 public class TestBase {
 
@@ -118,10 +118,9 @@ public class TestBase {
         wsdlReader.setFeature("javax.wsdl.verbose", false);
         Definition def = wsdlReader.readWSDL(wsdlUrl);
 
-        IMocksControl control = EasyMock.createNiceControl();
-        Bus bus = control.createMock(Bus.class);
-        BindingFactoryManager bindingFactoryManager = control.createMock(BindingFactoryManager.class);
-        DestinationFactoryManager dfm = control.createMock(DestinationFactoryManager.class);
+        Bus bus = mock(Bus.class);
+        BindingFactoryManager bindingFactoryManager = mock(BindingFactoryManager.class);
+        DestinationFactoryManager dfm = mock(DestinationFactoryManager.class);
         WSDLServiceBuilder wsdlServiceBuilder = new WSDLServiceBuilder(bus);
 
         Service service = null;
@@ -133,9 +132,8 @@ public class TestBase {
             }
         }
 
-        EasyMock.expect(bus.getExtension(BindingFactoryManager.class)).andReturn(bindingFactoryManager);
-        EasyMock.expect(bus.getExtension(DestinationFactoryManager.class)).andStubReturn(dfm);
-        control.replay();
+        when(bus.getExtension(BindingFactoryManager.class)).thenReturn(bindingFactoryManager);
+        when(bus.getExtension(DestinationFactoryManager.class)).thenReturn(dfm);
 
         ServiceInfo serviceInfo = wsdlServiceBuilder.buildServices(def, service).get(0);
         serviceInfo.setProperty(WSDLServiceBuilder.WSDL_DEFINITION, null);
diff --git a/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptorTest.java b/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptorTest.java
index a7f6fd2974..5e34de7051 100644
--- a/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptorTest.java
+++ b/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptorTest.java
@@ -31,68 +31,50 @@ import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.SoapVersion;
 import org.apache.cxf.message.Message;
 
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
-import org.junit.Before;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 /**
  *
  */
 public class SoapActionInInterceptorTest {
-    private IMocksControl control;
-
-    @Before
-    public void setUp() {
-        control = EasyMock.createNiceControl();
-    }
-
     @Test
     public void testGetSoapActionForSOAP11() throws Exception {
         SoapMessage message = setUpMessage("text/xml", Soap11.getInstance(), "urn:cxf");
-        control.replay();
         String action = SoapActionInInterceptor.getSoapAction(message);
         assertEquals("urn:cxf", action);
-        control.verify();
     }
 
     @Test
     public void testGetSoapActionForSOAP11None() throws Exception {
         SoapMessage message = setUpMessage("text/xml", Soap11.getInstance(), null);
-        control.replay();
         String action = SoapActionInInterceptor.getSoapAction(message);
         assertNull(action);
-        control.verify();
     }
 
     @Test
     public void testGetSoapActionForSOAP12() throws Exception {
         SoapMessage message = setUpMessage("application/soap+xml; action=\"urn:cxf\"", Soap12.getInstance(), null);
-        control.replay();
         String action = SoapActionInInterceptor.getSoapAction(message);
         assertEquals("urn:cxf", action);
-        control.verify();
     }
 
     @Test
     public void testGetSoapActionForSOAP12None() throws Exception {
         SoapMessage message = setUpMessage("application/soap+xml", Soap12.getInstance(), null);
-        control.replay();
         String action = SoapActionInInterceptor.getSoapAction(message);
         assertNull(action);
-        control.verify();
     }
 
     @Test
     public void testGetSoapActionForSOAP11SwA() throws Exception {
         SoapMessage message = setUpMessage("multipart/related", Soap11.getInstance(), "urn:cxf");
-        control.replay();
         String action = SoapActionInInterceptor.getSoapAction(message);
         assertEquals("urn:cxf", action);
-        control.verify();
     }
 
     @Test
@@ -102,10 +84,8 @@ public class SoapActionInInterceptorTest {
         SoapMessage message = setUpMessage(
             "multipart/related; start-info=\"application/soap+xml; action=\\\"urn:cxf\\\"",
             Soap12.getInstance(), null);
-        control.replay();
         String action = SoapActionInInterceptor.getSoapAction(message);
         assertEquals("urn:cxf", action);
-        control.verify();
     }
 
     @Test
@@ -116,10 +96,8 @@ public class SoapActionInInterceptorTest {
         SoapMessage message = setUpMessage(
             "multipart/related; start-info=\"application/soap+xml\"; action=\"urn:cxf\"",
             Soap12.getInstance(), null);
-        control.replay();
         String action = SoapActionInInterceptor.getSoapAction(message);
         assertEquals("urn:cxf", action);
-        control.verify();
     }
 
     @Test
@@ -129,10 +107,8 @@ public class SoapActionInInterceptorTest {
         SoapMessage message = setUpMessage(
             "multipart/related",
             Soap12.getInstance(), "urn:cxf");
-        control.replay();
         String action = SoapActionInInterceptor.getSoapAction(message);
         assertEquals("urn:cxf", action);
-        control.verify();
     }
 
     @Test
@@ -141,10 +117,8 @@ public class SoapActionInInterceptorTest {
         SoapMessage message = setUpMessage(
             "multipart/related",
             Soap12.getInstance(), null);
-        control.replay();
         String action = SoapActionInInterceptor.getSoapAction(message);
         assertNull(action);
-        control.verify();
     }
 
     @Test
@@ -152,10 +126,8 @@ public class SoapActionInInterceptorTest {
         SoapMessage message = setUpMessage(
             "multipart/related; type=\"application/xop+xml\"; start-info=\"text/xml\"",
             Soap11.getInstance(), "urn:cxf");
-        control.replay();
         String action = SoapActionInInterceptor.getSoapAction(message);
         assertEquals("urn:cxf", action);
-        control.verify();
     }
 
     @Test
@@ -167,14 +139,12 @@ public class SoapActionInInterceptorTest {
             "multipart/related; type=\"application/xop+xml\""
                 + "; start-info=\"application/soap+xml\"; action=\"urn:cxf\"",
             Soap11.getInstance(), "urn:cxf");
-        control.replay();
         String action = SoapActionInInterceptor.getSoapAction(message);
         assertEquals("urn:cxf", action);
-        control.verify();
     }
 
     private SoapMessage setUpMessage(String contentType, SoapVersion version, String prop) {
-        SoapMessage message = control.createMock(SoapMessage.class);
+        SoapMessage message = mock(SoapMessage.class);
         Map<String, List<String>> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
         Map<String, List<String>> partHeaders = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
         if (version instanceof Soap11 && prop != null) {
@@ -183,10 +153,10 @@ public class SoapActionInInterceptorTest {
             partHeaders.put(Message.CONTENT_TYPE,
                             Collections.singletonList("application/soap+xml; action=\"" + prop + "\""));
         }
-        EasyMock.expect(message.getVersion()).andReturn(version).anyTimes();
-        EasyMock.expect(message.get(Message.CONTENT_TYPE)).andReturn(contentType).anyTimes();
-        EasyMock.expect(message.get(Message.PROTOCOL_HEADERS)).andReturn(headers).anyTimes();
-        EasyMock.expect(message.get(AttachmentDeserializer.ATTACHMENT_PART_HEADERS)).andReturn(partHeaders).anyTimes();
+        when(message.getVersion()).thenReturn(version);
+        when(message.get(Message.CONTENT_TYPE)).thenReturn(contentType);
+        when(message.get(Message.PROTOCOL_HEADERS)).thenReturn(headers);
+        when(message.get(AttachmentDeserializer.ATTACHMENT_PART_HEADERS)).thenReturn(partHeaders);
         return message;
     }
 }
\ No newline at end of file
diff --git a/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/SoapPreProtocolOutInterceptorTest.java b/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/SoapPreProtocolOutInterceptorTest.java
index a790eb86f3..41d94a4d6d 100755
--- a/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/SoapPreProtocolOutInterceptorTest.java
+++ b/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/SoapPreProtocolOutInterceptorTest.java
@@ -38,8 +38,6 @@ import org.apache.cxf.service.model.MessageInfo.Type;
 import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -51,12 +49,10 @@ import static org.junit.Assert.assertTrue;
  *
  */
 public class SoapPreProtocolOutInterceptorTest {
-    private IMocksControl control;
     private SoapPreProtocolOutInterceptor interceptor;
 
     @Before
     public void setUp() {
-        control = EasyMock.createNiceControl();
         interceptor = new SoapPreProtocolOutInterceptor();
     }
 
@@ -64,7 +60,6 @@ public class SoapPreProtocolOutInterceptorTest {
     public void testRequestorOutboundSoapAction() throws Exception {
         SoapMessage message = setUpMessage();
         interceptor.handleMessage(message);
-        control.verify();
 
         Map<String, List<String>> reqHeaders
             = CastUtils.cast((Map<?, ?>)message.get(Message.PROTOCOL_HEADERS));
@@ -89,7 +84,6 @@ public class SoapPreProtocolOutInterceptorTest {
         message.setExchange(exchange);
         message.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
 
-        control.replay();
         return message;
     }
 
diff --git a/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/jms/interceptor/SoapFaultFactoryTest.java b/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/jms/interceptor/SoapFaultFactoryTest.java
index 3986ba67c0..65841e520c 100644
--- a/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/jms/interceptor/SoapFaultFactoryTest.java
+++ b/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/jms/interceptor/SoapFaultFactoryTest.java
@@ -26,37 +26,30 @@ import org.apache.cxf.binding.soap.Soap12;
 import org.apache.cxf.binding.soap.SoapBinding;
 import org.apache.cxf.binding.soap.SoapFault;
 
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
-import org.junit.Before;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertSame;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 /**
  *
  */
 public class SoapFaultFactoryTest {
 
-    private IMocksControl control;
     private JMSFault jmsFault;
 
-    @Before
-    public void setUp() {
-        control = EasyMock.createNiceControl();
-    }
-
     JMSFault setupJMSFault(boolean isSender, QName code, Object detail, boolean isSoap12) {
-        jmsFault = control.createMock(JMSFault.class);
-        EasyMock.expect(jmsFault.getReason()).andReturn("reason");
+        jmsFault = mock(JMSFault.class);
+        when(jmsFault.getReason()).thenReturn("reason");
         if (isSoap12) {
-            EasyMock.expect(jmsFault.isSender()).andReturn(isSender);
+            when(jmsFault.isSender()).thenReturn(isSender);
         }
-        EasyMock.expect(jmsFault.getSubCode()).andReturn(code);
+        when(jmsFault.getSubCode()).thenReturn(code);
         if (null != detail) {
-            EasyMock.expect(jmsFault.getDetail()).andReturn(detail);
+            when(jmsFault.getDetail()).thenReturn(detail);
             JMSFaultType sft = new JMSFaultType();
             sft.setFaultCode(SoapJMSConstants.getContentTypeMismatchQName());
         }
@@ -65,10 +58,9 @@ public class SoapFaultFactoryTest {
 
     @Test
     public void createSoap11Fault() {
-        SoapBinding sb = control.createMock(SoapBinding.class);
-        EasyMock.expect(sb.getSoapVersion()).andReturn(Soap11.getInstance());
+        SoapBinding sb = mock(SoapBinding.class);
+        when(sb.getSoapVersion()).thenReturn(Soap11.getInstance());
         setupJMSFault(true, SoapJMSConstants.getContentTypeMismatchQName(), null, false);
-        control.replay();
 
         SoapFaultFactory factory = new SoapFaultFactory(sb);
         SoapFault fault = (SoapFault)factory.createFault(jmsFault);
@@ -76,15 +68,13 @@ public class SoapFaultFactoryTest {
         assertEquals(SoapJMSConstants.getContentTypeMismatchQName(), fault.getFaultCode());
         assertNull(fault.getDetail());
         assertSame(jmsFault, fault.getCause());
-        control.verify();
     }
 
     @Test
     public void createSoap12Fault() {
-        SoapBinding sb = control.createMock(SoapBinding.class);
-        EasyMock.expect(sb.getSoapVersion()).andReturn(Soap12.getInstance());
+        SoapBinding sb = mock(SoapBinding.class);
+        when(sb.getSoapVersion()).thenReturn(Soap12.getInstance());
         setupJMSFault(true, SoapJMSConstants.getMismatchedSoapActionQName(), null, true);
-        control.replay();
         SoapFaultFactory factory = new SoapFaultFactory(sb);
         SoapFault fault = (SoapFault)factory.createFault(jmsFault);
         assertEquals("reason", fault.getReason());
@@ -92,6 +82,5 @@ public class SoapFaultFactoryTest {
         assertEquals(SoapJMSConstants.getMismatchedSoapActionQName(), fault.getSubCode());
         assertNull(fault.getDetail());
         assertNull(fault.getCause());
-        control.verify();
     }
 }
\ No newline at end of file