|
|
|
|
@ -25,6 +25,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
@@ -25,6 +25,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
|
|
|
|
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; |
|
|
|
|
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.standaloneSetup; |
|
|
|
|
|
|
|
|
|
import org.hamcrest.Matcher; |
|
|
|
|
import org.junit.Before; |
|
|
|
|
import org.junit.Test; |
|
|
|
|
import org.springframework.http.HttpStatus; |
|
|
|
|
@ -60,11 +61,10 @@ public class StatusAssertionTests {
@@ -60,11 +61,10 @@ public class StatusAssertionTests {
|
|
|
|
|
this.mockMvc.perform(get("/badRequest")).andExpect(status().isBadRequest()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
|
@Test |
|
|
|
|
public void testMatcher() throws Exception { |
|
|
|
|
this.mockMvc.perform(get("/badRequest")) |
|
|
|
|
.andExpect(status().is(allOf(greaterThanOrEqualTo(400), lessThan(500)))); |
|
|
|
|
Matcher<Integer> matcher = allOf(greaterThanOrEqualTo(400), lessThan(500)); |
|
|
|
|
this.mockMvc.perform(get("/badRequest")).andExpect(status().is(matcher)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|