Java Code Examples for javax.ws.rs.ClientErrorException#getClass()

The following examples show how to use javax.ws.rs.ClientErrorException#getClass() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FailureTypeUtilTest.java    From robozonky with Apache License 2.0 5 votes vote down vote up
@Test
void expectedReasonMatches() {
    final String reason = UUID.randomUUID()
        .toString();
    final Response response = Response.status(400)
        .entity(reason)
        .build();
    final ClientErrorException actual = new BadRequestException(response);
    final Class<? extends ClientErrorException> expected = actual.getClass();
    assertThat(FailureTypeUtil.matches(expected, actual, reason)).isTrue();
}
 
Example 2
Source File: FailureTypeUtilTest.java    From robozonky with Apache License 2.0 5 votes vote down vote up
@Test
void expectedReasonDoesNotMatch() {
    final String reason = UUID.randomUUID()
        .toString();
    final Response response = Response.status(400)
        .entity(reason)
        .build();
    final ClientErrorException actual = new BadRequestException(response);
    final Class<? extends ClientErrorException> expected = actual.getClass();
    assertThat(FailureTypeUtil.matches(expected, actual, UUID.randomUUID()
        .toString())).isFalse();
}
 
Example 3
Source File: FailureTypeUtilTest.java    From robozonky with Apache License 2.0 4 votes vote down vote up
@Test
void noExpectedReason() {
    final ClientErrorException actual = new BadRequestException();
    final Class<? extends ClientErrorException> expected = actual.getClass();
    assertThat(FailureTypeUtil.matches(expected, actual, null)).isTrue();
}