@Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); when(mockStorageHelpers.getApiKeyFromManifest(any(Context.class), eq(StorageHelpers .DIGITS_CONSUMER_KEY_KEY))).thenReturn(DIGITS_CONSUMER_KEY); when(mockStorageHelpers.getApiKeyFromManifest(any(Context.class), eq(StorageHelpers .DIGITS_CONSUMER_SECRET_KEY))).thenReturn(DIGITS_CONSUMER_SECRET); when(mockStorageHelpers.getApiKeyFromManifest(any(Context.class), eq(StorageHelpers .FABRIC_API_KEY_KEY))).thenReturn(FABRIC_API_KEY); authResult = new AuthResult() { @Override public FirebaseUser getUser() { return mockFirebaseUser; } @Override public AdditionalUserInfo getAdditionalUserInfo() { return null; } }; authResultTask = Tasks.forResult(authResult); }
/** * Pretends this task is failing after a certain period. */ private void fakeSuccessAfterDelay(OnSuccessListener<? super AuthResult> onSuccessListener) { new Handler().postDelayed(() -> onSuccessListener.onSuccess(new AuthResult() { @Override public FirebaseUser getUser() { return null; } @Override public AdditionalUserInfo getAdditionalUserInfo() { return null; } }), 200); }
@Override public AdditionalUserInfo getAdditionalUserInfo() { return null; }