@Test
public void shouldCallCallbackOnInvalidResponse() {

    mockServer.expect().withPath("/api/info").andReturn(200, "INVALID_RESPONSE").once();
    RocketChatVerifier.checkServerVersion(client, baseUrl.toString(), verifier, callback);
    verify(callback, timeout(1000)
            .times(1))
            .onError(exceptionCaptor.capture());
    assertThat(exceptionCaptor.getValue(),
            is(instanceOf(RocketChatException.class)));
    assertThat(exceptionCaptor.getValue().getCause(),
            is(instanceOf(JsonEncodingException.class)));
    assertThat(exceptionCaptor.getValue().getMessage(),
            containsString("Use JsonReader.setLenient"));
}