-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: testIssues in the test moduleIssues in the test modulein: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement
Milestone
Description
Oliver Drotbohm opened SPR-11424 and commented
The status() method of MockMvcResultMatchers exposes a method per status code. This works fine if I want to express a particular code expected.
However, if I want to express a certain type of code (e.g. 1xx, 2xx etc.) I have to fall back to something like this:
….andExpect(status().is(both(greaterThanOrEqualTo(200)).and(lessThan(300))));A short
–.andExpect(status().inRangeSuccess()); // expecting 2xxwould be easier to write and read. The method could also be named isSuccess() but I think it might make sense to clearly separate the range check methods from the ones checking for an individual status code.
Affects: 4.0.1
Metadata
Metadata
Assignees
Labels
in: testIssues in the test moduleIssues in the test modulein: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement