Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix test
  • Loading branch information
tvolkert committed Jan 25, 2023
commit 75ccc3aeef262658749083c58b9f9ed8e7dd12c0
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public class GoogleSignInTest {
@Mock PluginRegistry.Registrar mockRegistrar;
@Mock BinaryMessenger mockMessenger;
@Spy MethodChannel.Result result;
@Mock MethodChannel.Result mockResult;
@Mock GoogleSignInWrapper mockGoogleSignIn;
@Mock GoogleSignInAccount account;
@Mock GoogleSignInClient mockClient;
Expand Down Expand Up @@ -217,24 +216,18 @@ public void signInSilentlyThatImmediatelyCompletesWithoutResultFinishesWithError
MethodCall methodCall = buildInitMethodCall(clientId, null);
initAndAssertServerClientId(methodCall, clientId);

ArgumentCaptor<String> code = ArgumentCaptor.forClass(String.class);
ArgumentCaptor<String> message = ArgumentCaptor.forClass(String.class);

ApiException exception =
new ApiException(new Status(CommonStatusCodes.SIGN_IN_REQUIRED, "Error text"));
when(mockClient.silentSignIn()).thenReturn(mockSignInTask);
when(mockSignInTask.isComplete()).thenReturn(true);
when(mockSignInTask.getResult(ApiException.class)).thenThrow(exception);

plugin.onMethodCall(new MethodCall("signInSilently", null), mockResult);
verify(mockResult).error(code.capture(), message.capture(), any());
System.out.println("~!@ :: " + code.getValue());
System.out.println("~!@ :: " + message.getValue());
Assert.assertEquals(CommonStatusCodes.SIGN_IN_REQUIRED + ": Error text", message.getValue());
/*
plugin.onMethodCall(new MethodCall("signInSilently", null), result);
verify(result)
.error("sign_in_required", CommonStatusCodes.SIGN_IN_REQUIRED + ": Error text", null);
*/
.error(
"sign_in_required",
"com.google.android.gms.common.api.ApiException: 4: Error text",
null);
}

@Test
Expand Down