@Test
public void prefetchValidToken() {

    final Cognito preCognito = new Cognito(TOKEN, IDENTITY_ID, EXPIRES_AT);
    Mockito.when(localCognitoTokenStore.getCognitoToken()).thenReturn(preCognito);
    final TestObserver<Optional<Cognito>> testObserver = cognitoIdentityProvider.prefetchCognitoTokenIfNeeded().test();
    Mockito.verify(localCognitoTokenStore, Mockito.never()).persist(ArgumentMatchers.any(Cognito.class));
    testObserver.assertValue(Optional.of(preCognito))
            .assertComplete()
            .assertNoErrors();
}