Source:
<code>public void testprocessUIResponseParams() throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, ClassNotFoundException, NoSuchMethodException, InstantiationException { <START> Map<String, String> response = new HashMap<>(); <END> Object request = createAuthenticationRequest("authority", "resource", "client", "redirect", "loginhint", null, null, null); Object oauth = createOAuthInstance(request); Method m = ReflectionUtils.getTestMethod(oauth, "processUIResponseParams", Map.class); AuthenticationResult result = (AuthenticationResult)m.invoke(null, response); assertNull("Result is null", result); response.put(AuthenticationConstants.OAuth2.ERROR, "error"); response.put(AuthenticationConstants.OAuth2.ERROR_DESCRIPTION, "error description"); result = (AuthenticationResult)m.invoke(null, response); assertEquals("Failed status", AuthenticationStatus.Failed, result.getStatus()); assertEquals("Error is same", "error", result.getErrorCode()); assertEquals("Error description is same", "error description", result.getErrorDescription()); response.clear(); response.put(AuthenticationConstants.OAuth2.ACCESS_TOKEN, "token"); result = (AuthenticationResult)m.invoke(null, response); assertEquals("Success status", AuthenticationStatus.Succeeded, result.getStatus()); assertEquals("Token is same", "token", result.getAccessToken()); assertFalse("MultiResource token", result.getIsMultiResourceRefreshToken()); response.put(AuthenticationConstants.AAD.RESOURCE, "resource"); result = (AuthenticationResult)m.invoke(null, response); assertEquals("Success status", AuthenticationStatus.Succeeded, result.getStatus()); assertEquals("Token is same", "token", result.getAccessToken()); assertTrue("MultiResource token", result.getIsMultiResourceRefreshToken()); }</code><technical_language>nit: this final? :)</technical_language>

Target:
public void testprocessUIResponseParams() throws IllegalAccessException, InvocationTargetException, ClassNotFoundException, NoSuchMethodException, InstantiationException { final Map<String, String> response = new HashMap<>(); Object request = createAuthenticationRequest("authority", "resource", "client", "redirect", "loginhint", null, null, null); Object oauth = createOAuthInstance(request); final Method m = ReflectionUtils.getTestMethod(oauth, "processUIResponseParams", Map.class); AuthenticationResult result = (AuthenticationResult) m.invoke(null, response); assertNull("Result is null", result); response.put(AuthenticationConstants.OAuth2.ERROR, "error"); response.put(AuthenticationConstants.OAuth2.ERROR_DESCRIPTION, "error description"); result = (AuthenticationResult) m.invoke(null, response); assertEquals("Failed status", AuthenticationStatus.Failed, result.getStatus()); assertEquals("Error is same", "error", result.getErrorCode()); assertEquals("Error description is same", "error description", result.getErrorDescription()); response.clear(); response.put(AuthenticationConstants.OAuth2.ACCESS_TOKEN, "token"); result = (AuthenticationResult) m.invoke(null, response); assertEquals("Success status", AuthenticationStatus.Succeeded, result.getStatus()); assertEquals("Token is same", "token", result.getAccessToken()); assertFalse("MultiResource token", result.getIsMultiResourceRefreshToken()); response.put(AuthenticationConstants.AAD.RESOURCE, "resource"); result = (AuthenticationResult) m.invoke(null, response); assertEquals("Success status", AuthenticationStatus.Succeeded, result.getStatus()); assertEquals("Token is same", "token", result.getAccessToken()); assertTrue("MultiResource token", result.getIsMultiResourceRefreshToken()); }