File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
main/java/org/springframework/test/web/client
test/java/org/springframework/test/web/client Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -241,7 +241,7 @@ public DefaultBuilder(AsyncRestTemplate asyncRestTemplate) {
241
241
242
242
@ Override
243
243
public MockRestServiceServerBuilder ignoreExpectOrder (boolean ignoreExpectOrder ) {
244
- this .ignoreExpectOrder = true ;
244
+ this .ignoreExpectOrder = ignoreExpectOrder ;
245
245
return this ;
246
246
}
247
247
Original file line number Diff line number Diff line change @@ -54,6 +54,28 @@ public void buildMultipleTimes() throws Exception {
54
54
server .verify ();
55
55
}
56
56
57
+ @ Test (expected = AssertionError .class )
58
+ public void exactExpectOrder () throws Exception {
59
+ MockRestServiceServer server = MockRestServiceServer .bindTo (this .restTemplate )
60
+ .ignoreExpectOrder (false ).build ();
61
+
62
+ server .expect (requestTo ("/foo" )).andRespond (withSuccess ());
63
+ server .expect (requestTo ("/bar" )).andRespond (withSuccess ());
64
+ this .restTemplate .getForObject ("/bar" , Void .class );
65
+ }
66
+
67
+ @ Test
68
+ public void ignoreExpectOrder () throws Exception {
69
+ MockRestServiceServer server = MockRestServiceServer .bindTo (this .restTemplate )
70
+ .ignoreExpectOrder (true ).build ();
71
+
72
+ server .expect (requestTo ("/foo" )).andRespond (withSuccess ());
73
+ server .expect (requestTo ("/bar" )).andRespond (withSuccess ());
74
+ this .restTemplate .getForObject ("/bar" , Void .class );
75
+ this .restTemplate .getForObject ("/foo" , Void .class );
76
+ server .verify ();
77
+ }
78
+
57
79
@ Test
58
80
public void resetAndReuseServer () throws Exception {
59
81
MockRestServiceServer server = MockRestServiceServer .bindTo (this .restTemplate ).build ();
You can’t perform that action at this time.
0 commit comments