0

I have a class AMSClient, which I want to simulate using WireMock. I have seen some examples but I couldn't understand them, as they are using port numbers. Can any one tell me how to simulate a class using WireMock.

Marit
  • 2,399
  • 18
  • 27
Sat
  • 3,520
  • 9
  • 39
  • 66
  • Welcome to SO. If you didn't understand the other examples, you need to be more specific. There's no sense in showing another one that you won't understand. Also, asking for tutorial is considered off-topic on this site. – Eiko May 31 '16 at 11:52

2 Answers2

1

WireMock isn't an object mocking tool. If you're looking to mock a class or interface I'd suggest looking at Mockito.

However, if the class/interface in question wraps HTTP calls to another service, then WireMock can help by mimicking the HTTP responses from the service.

Tom
  • 3,471
  • 21
  • 14
  • public static AMSResponse postAMS(String amsUrl, AMSRequest request) throws Exception { //Code } this method is called from another class method, for which I am writing test cases I have to mock this method but I dont know – Sat May 31 '16 at 11:42
0

Using power mockito concept, I solved this issue

https://examples.javacodegeeks.com/core-java/mockito/powermock-mockito-integration-example/

Sat
  • 3,520
  • 9
  • 39
  • 66