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
Next Next commit
Diagnose failing test
  • Loading branch information
tvolkert committed Jan 25, 2023
commit eadf792932a386469d52cd62de957dade796c5ed
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ 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 @@ -216,15 +217,24 @@ 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);
verify(mockResult).error(code.capture(), message.capture(), null);

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), result);
plugin.onMethodCall(new MethodCall("signInSilently", null), mockResult);
System.out.println("~!@ :: " + code.getValue());
System.out.println("~!@ :: " + message.getValue());
Assert.assertEquals(CommonStatusCodes.SIGN_IN_REQUIRED + ": Error text", message.getValue());
/*
verify(result)
.error("sign_in_required", CommonStatusCodes.SIGN_IN_REQUIRED + ": Error text", null);
*/
}

@Test
Expand Down