MockRestServiceServer exception while running junit

55 Views Asked by At

Here I have mocked both rest api, but sometimes it breaks with this error, if I swap url mock declaration then it works for few tests, then again start failing, does sequence matters here?

java.lang.AssertionError: Unexpected request expected:<http://smart-graph-api:8000/api/v1.4/data/write> but was:<http://smart-graph-api:8000/api/v1.4/topology/nodes>
    at org.springframework.test.util.AssertionErrors.fail(AssertionErrors.java:59)
    at org.springframework.test.util.AssertionErrors.assertEquals(AssertionErrors.java:122)
    at org.springframework.test.web.client.match.MockRestRequestMatchers.lambda$requestTo$4(MockRestRequestMatchers.java:113)
    at org.springframework.test.web.client.DefaultRequestExpectation.match(DefaultRequestExpectation.java:87)
    at org.springframework.test.web.client.SimpleRequestExpectationManager.matchRequest(SimpleRequestExpectationManager.java:62)
    at org.springframework.test.web.client.AbstractRequestExpectationManager.validateRequest(AbstractRequestExpectationManager.java:91)
    at org.springframework.test.web.client.MockRestServiceServer$MockClientHttpRequestFactory$1.executeInternal(MockRestServiceServer.java:287)
    at org.springframework.mock.http.client.MockClientHttpRequest.execute(MockClientHttpRequest.java:12
0

There are 0 best solutions below