@Test
public void testSigninShouldFailWithAuthExceptionOn401() {

    mockServer.expect()
            .post()
            .withPath("/api/v1/login")
            .andReturn(401, "{\"status\": \"error\",\"message\": \"Unauthorized\"}")
            .once();
    rest.signin("user", "password", loginCallback);
    verify(loginCallback, timeout(DEFAULT_TIMEOUT).only())
            .onError(exceptionCaptor.capture());
    RocketChatException exception = exceptionCaptor.getValue();
    assertThat(exception, is(instanceOf(RocketChatAuthException.class)));
    assertThat(exception.getMessage(), is(equalTo("Unauthorized")));
}