HttpMatchers { public static Matcher<Response> noContent() { final int statusCode = Response.Status.NO_CONTENT.getStatusCode(); return new CustomMatcher<Response>("no content (" + statusCode + ")") { @Override public boolean matches(Object o) { return (o instanceof Response) && (((Response) o).getStatus() == statusCode); } @Override public void describeMismatch(Object item, Description description) { Response response = (Response) item; provideDescription(response, description); } }; }  static Matcher<Response> successful(); static Matcher<Response> clientError(); static Matcher<Response> redirection(); static Matcher<Response> informational(); static Matcher<Response> other(); static Matcher<Response> noContent(); static Matcher<Response> serverError(); static Matcher<Response> created();  }
@Test public void noContentMatcher() { Matcher<Response> noContent = HttpMatchers.noContent(); Response response = mock(Response.class); when(response.getStatus()).thenReturn(204); assertThat(response, is(noContent)); }