Fix hardcoded value MockRestServiceServerBuilder
This commit is contained in:
@@ -241,7 +241,7 @@ public class MockRestServiceServer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MockRestServiceServerBuilder ignoreExpectOrder(boolean ignoreExpectOrder) {
|
public MockRestServiceServerBuilder ignoreExpectOrder(boolean ignoreExpectOrder) {
|
||||||
this.ignoreExpectOrder = true;
|
this.ignoreExpectOrder = ignoreExpectOrder;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,28 @@ public class MockRestServiceServerTests {
|
|||||||
server.verify();
|
server.verify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(expected = AssertionError.class)
|
||||||
|
public void exactExpectOrder() throws Exception {
|
||||||
|
MockRestServiceServer server = MockRestServiceServer.bindTo(this.restTemplate)
|
||||||
|
.ignoreExpectOrder(false).build();
|
||||||
|
|
||||||
|
server.expect(requestTo("/foo")).andRespond(withSuccess());
|
||||||
|
server.expect(requestTo("/bar")).andRespond(withSuccess());
|
||||||
|
this.restTemplate.getForObject("/bar", Void.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void ignoreExpectOrder() throws Exception {
|
||||||
|
MockRestServiceServer server = MockRestServiceServer.bindTo(this.restTemplate)
|
||||||
|
.ignoreExpectOrder(true).build();
|
||||||
|
|
||||||
|
server.expect(requestTo("/foo")).andRespond(withSuccess());
|
||||||
|
server.expect(requestTo("/bar")).andRespond(withSuccess());
|
||||||
|
this.restTemplate.getForObject("/bar", Void.class);
|
||||||
|
this.restTemplate.getForObject("/foo", Void.class);
|
||||||
|
server.verify();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void resetAndReuseServer() throws Exception {
|
public void resetAndReuseServer() throws Exception {
|
||||||
MockRestServiceServer server = MockRestServiceServer.bindTo(this.restTemplate).build();
|
MockRestServiceServer server = MockRestServiceServer.bindTo(this.restTemplate).build();
|
||||||
|
|||||||
Reference in New Issue
Block a user