CognitoIdentityProvider { @NonNull public Optional<Cognito> getCachedCognitoToken() { Cognito cognitoToken = localCognitoTokenStore.getCognitoToken(); return cognitoToken != null ? Optional.of(cognitoToken) : Optional.absent(); } @Inject  CognitoIdentityProvider(@NonNull IdentityManager identityManager,
                                   @NonNull LocalCognitoTokenStore localCognitoTokenStore); @NonNull Single<Optional<Cognito>> prefetchCognitoTokenIfNeeded(); @NonNull Single<Optional<Cognito>> refreshCognitoToken(); @Nullable Cognito synchronouslyRefreshCognitoToken(); @NonNull Optional<Cognito> getCachedCognitoToken();  }
@Test public void getCachedCognitoToken() { assertEquals(new Cognito(TOKEN, IDENTITY_ID, EXPIRES_AT), cognitoIdentityProvider.getCachedCognitoToken().get()); Mockito.verify(localCognitoTokenStore).getCognitoToken(); }