@Test
public void badStatus() {

    String expectedMessage = "{\"message\": \"bad authentication\"}";
    stubFor(any(anyUrl()).willReturn(aResponse()
                                             .withStatus(500)
                                             .withBody(expectedMessage)));
    assertThatThrownBy(() -> client.getSamplingRules(new GetSamplingRulesRequest()))
            .isInstanceOf(XrayClientException.class)
            .hasMessageContaining(expectedMessage);
}