@Test
public void testSigninShouldFailWithRocketChatNetworkErrorException() {

    doAnswer(new Answer() {
        @Override
        public Object answer(InvocationOnMock invocation) throws Throwable {
            ((LoginCallback) invocation.getArguments()[2]).onError(new RocketChatNetworkErrorException("network error"));
            return null;
        }
    }).when(api).signin(any(String.class), any(String.class), any(LoginCallback.class));
    TestObserver<Token> testObserver = sut.signin("username", "password").test();
    testObserver.assertError(new Predicate<Throwable>() {
        @Override
        public boolean test(Throwable throwable) throws Exception {
            return throwable != null
                    && throwable instanceof RocketChatNetworkErrorException
                    && throwable.getMessage().contentEquals("network error");
        }
    });
    testObserver.assertNoValues();
}