Created
May 11, 2017 13:11
-
-
Save compwron/3692a8c3ef7ad1459a1a4ba6863fa5b9 to your computer and use it in GitHub Desktop.
hamcrest matcher for http status
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Matcher<ResponseEntity<String>> httpStatus(final HttpStatus httpStatus) { | |
return new BaseMatcher<ResponseEntity<String>>() { | |
@Override | |
public boolean matches(final Object item) { | |
final ResponseEntity<String> responseEntity = (ResponseEntity<String>) item; | |
return httpStatus.equals(responseEntity.getStatusCode()); | |
} | |
@Override | |
public void describeTo(final Description description) { | |
description.appendText("Status code should be ").appendValue(httpStatus); | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment