I have an outdated application that works with a third-party web service through JAX-RPC. Now I need to do unit testing of the application, mocking some XML RPC calls with test data. In fact, I need to replace Apache Axis , which is used by the application, with another library that will be JAX-RPC-compatible, but will return what I say to return. I am sure that I am not alone with such a problem ... Are there any open source libraries for this purpose?
You can do this with the Spring framework and EasyMock.
What is the best framework for Java?
WireMock. Jetty, , . XML-RPC . .
stubFor(post(urlEqualTo("/RPC2")) .withRequestBody(containing("<methodName>...</methodName>")) .willReturn(aResponse() .withBody("<methodResponse>...</methodResponse>")));
You can use to redirect calls to external services EasyMock+Powermockor Mockito you can do something like this
EasyMock+Powermock
Mockito
Easymock.expect(your function calling external Systems).andReturn(your required output)
hope this helps!
Good luck