@@ -59,38 +59,38 @@ class MsAuthPluginTest {
5959 void setUp () throws MsalException , InterruptedException {
6060 reset (mockedContext , mockedActivity , publicClientApplicationFactoryMock , singleAccountPublicClientApplication );
6161
62- when (publicClientApplicationFactoryMock .createSingleAccountPublicClientApplication (any (Context .class ), any (File .class )))
63- .thenReturn (singleAccountPublicClientApplication );
62+ when (publicClientApplicationFactoryMock .createSingleAccountPublicClientApplication (any (Context .class ), any (File .class ))).thenReturn (
63+ singleAccountPublicClientApplication
64+ );
6465
65- plugin =
66- new MsAuthPlugin (publicClientApplicationFactoryMock ) {
67- final Context applicationContext = mock (Context .class );
66+ plugin = new MsAuthPlugin (publicClientApplicationFactoryMock ) {
67+ final Context applicationContext = mock (Context .class );
6868
69- @ Override
70- public Context getContext () {
71- when (mockedContext .getApplicationContext ()).thenReturn (applicationContext );
69+ @ Override
70+ public Context getContext () {
71+ when (mockedContext .getApplicationContext ()).thenReturn (applicationContext );
7272
73- return mockedContext ;
74- }
73+ return mockedContext ;
74+ }
7575
76- @ Override
77- public AppCompatActivity getActivity () {
78- lenient ().when (applicationContext .getPackageName ()).thenReturn ("nl.recognize.project-x" );
79- lenient ().when (mockedActivity .getApplicationContext ()).thenReturn (applicationContext );
76+ @ Override
77+ public AppCompatActivity getActivity () {
78+ lenient ().when (applicationContext .getPackageName ()).thenReturn ("nl.recognize.project-x" );
79+ lenient ().when (mockedActivity .getApplicationContext ()).thenReturn (applicationContext );
8080
81- return mockedActivity ;
82- }
81+ return mockedActivity ;
82+ }
8383
84- @ Override
85- protected String getLogTag () {
86- return "LogTag" ;
87- }
84+ @ Override
85+ protected String getLogTag () {
86+ return "LogTag" ;
87+ }
8888
89- @ Override
90- protected String getAuthorityUrl (ISingleAccountPublicClientApplication context ) {
91- return AUTHORITY_URL ;
92- }
93- };
89+ @ Override
90+ protected String getAuthorityUrl (ISingleAccountPublicClientApplication context ) {
91+ return AUTHORITY_URL ;
92+ }
93+ };
9494 }
9595
9696 @ Test
@@ -109,8 +109,7 @@ void loginExpectAcquireTokenSilent() throws JSONException, MsalException, Interr
109109 parameters -> parameters .getScopes ().equals (List .of ("mocked-scope" )) && parameters .getAuthority ().equals (AUTHORITY_URL )
110110 )
111111 )
112- )
113- .thenReturn (result );
112+ ).thenReturn (result );
114113
115114 ArgumentCaptor <JSObject > jsObjectCaptor = ArgumentCaptor .forClass (JSObject .class );
116115 doNothing ().when (pluginCallMock ).resolve (jsObjectCaptor .capture ());
@@ -123,31 +122,31 @@ void loginExpectAcquireTokenSilent() throws JSONException, MsalException, Interr
123122 assertEquals ("access-token" , resolve .getString ("accessToken" ));
124123 assertEquals (ID_TOKEN , resolve .getString ("idToken" ));
125124
126- verify (singleAccountPublicClientApplication )
127- .acquireTokenSilent (argThat (parameters -> parameters .getAuthority ().equals (AUTHORITY_URL )));
125+ verify (singleAccountPublicClientApplication ).acquireTokenSilent (
126+ argThat (parameters -> parameters .getAuthority ().equals (AUTHORITY_URL ))
127+ );
128128 }
129129
130130 private void initializePluginCallMockWithDefaults (PluginCall pluginCallMock ) throws JSONException {
131131 when (pluginCallMock .getArray ("scopes" )).thenReturn (new JSArray (new String [] { "mocked-scope" }));
132- when (pluginCallMock .getString (any ()))
133- .thenAnswer (
134- (Answer <String >) invocation -> {
135- switch (invocation .getArgument (0 ).toString ()) {
136- case "clientId" :
137- return CLIENT_ID ;
138- case "domainHint" :
139- return DOMAIN_HINT ;
140- case "tenant" :
141- return TENANT ;
142- case "keyHash" :
143- return KEY_HASH ;
144- case "authorityUrl" :
145- return AUTHORITY_URL ;
146- }
147-
148- return null ;
132+ when (pluginCallMock .getString (any ())).thenAnswer (
133+ (Answer <String >) invocation -> {
134+ switch (invocation .getArgument (0 ).toString ()) {
135+ case "clientId" :
136+ return CLIENT_ID ;
137+ case "domainHint" :
138+ return DOMAIN_HINT ;
139+ case "tenant" :
140+ return TENANT ;
141+ case "keyHash" :
142+ return KEY_HASH ;
143+ case "authorityUrl" :
144+ return AUTHORITY_URL ;
149145 }
150- );
146+
147+ return null ;
148+ }
149+ );
151150 when (pluginCallMock .getString ("authorityType" , AuthorityType .AAD .name ())).thenReturn ("AAD" );
152151 }
153152
0 commit comments