use of com.amazonaws.mobile.client.SignOutOptions in project amplify-android by aws-amplify.
the class AuthComponentTest method signOutWithBrowserPackage.
/**
* Tests that signOut called with options specifying an override for the browser package to use for signing out
* of a web UI sign in experience has the proper options set.
* @throws AuthException test fails if this gets thrown since method should succeed
*/
@Test
public void signOutWithBrowserPackage() throws AuthException {
String browserPackage = "org.mozilla.firefox";
doAnswer(invocation -> {
Callback<Void> callback = invocation.getArgument(1);
callback.onResult(null);
return null;
}).when(mobileClient).signOut(any(), any());
synchronousAuth.signOut(AWSCognitoAuthSignOutOptions.builder().browserPackage(browserPackage).build());
ArgumentCaptor<SignOutOptions> signOutOptionsCaptor = ArgumentCaptor.forClass(SignOutOptions.class);
verify(mobileClient).signOut(signOutOptionsCaptor.capture(), any());
assertFalse(signOutOptionsCaptor.getValue().isSignOutGlobally());
assertTrue(signOutOptionsCaptor.getValue().isInvalidateTokens());
assertEquals(browserPackage, signOutOptionsCaptor.getValue().getBrowserPackage());
}
Aggregations