@Test
public void refreshCognitoTokenThrowsException() {

    Mockito.when(identityManager.getMe()).thenReturn(Observable.<MeResponse>error(new IOException()));
    TestObserver<Optional<Cognito>> testObserver = cognitoIdentityProvider.refreshCognitoToken().test();
    Mockito.verify(localCognitoTokenStore).persist(null);
    testObserver.assertNoValues()
            .assertNotComplete()
            .assertError(IOException.class);
}