Add isTooEarly() method to StatusResultMatchers

See gh-23384
This commit is contained in:
Juergen Hoeller
2019-07-30 17:37:26 +02:00
parent 4f3b89e907
commit 27aaad5a89
2 changed files with 10 additions and 13 deletions

View File

@@ -20,7 +20,6 @@ import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.springframework.core.Conventions;
@@ -42,23 +41,14 @@ import static org.assertj.core.api.Assertions.fail;
*/
public class StatusResultMatchersTests {
private StatusResultMatchers matchers;
private final StatusResultMatchers matchers = new StatusResultMatchers();
private MockHttpServletRequest request;
@Before
public void setup() {
this.matchers = new StatusResultMatchers();
this.request = new MockHttpServletRequest();
}
private final MockHttpServletRequest request = new MockHttpServletRequest();
@Test
public void testHttpStatusCodeResultMatchers() throws Exception {
List<AssertionError> failures = new ArrayList<>();
for (HttpStatus status : HttpStatus.values()) {
MockHttpServletResponse response = new MockHttpServletResponse();
response.setStatus(status.value());
@@ -77,7 +67,6 @@ public class StatusResultMatchersTests {
throw new Exception("Failed to obtain ResultMatcher for status " + status, ex);
}
}
if (!failures.isEmpty()) {
fail("Failed status codes: " + failures);
}