UserAgentImpl implements UserAgent, ProviderScanner { static String extractResponseFromRedirectUri(final String redirectedUri) { final URL uri; try { uri = new URL(redirectedUri); return uri.getQuery(); } catch (MalformedURLException e) { } return null; } UserAgentImpl();   UserAgentImpl(final TestableProcessFactory processFactory, final Provider provider, final List<Provider> candidateProviders); @Override Provider findCompatibleProvider(); @Override Provider findCompatibleProvider(final String userAgentProvider); @Override Map<Provider, List<String>> getUnmetProviderRequirements(); @Override boolean hasCompatibleProvider(); @Override boolean hasCompatibleProvider(final String userAgentProvider); @Override AuthorizationResponse requestAuthorizationCode(final URI authorizationEndpoint, final URI redirectUri); static StringBuilder buildUnsupportedMessage(Map<Provider, List<String>> unmetRequirements); static void describeUnmetRequirements(final Map<Provider, List<String>> unmetRequirements, final StringBuilder destination);  }
@Test public void extractResponseFromRedirectUri_Typical() { final String redirectedUri = "https: "?code=AAABAAAAiL9Kn2Z27UubvWFPbm0gLSXKVsoCQ5SqteFtDHVxXA8fd44gIaK71" + "juLqGyAA&session_state=10f521b6-41a9-41ba-8faa-8645e74d5123"; final String actual = UserAgentImpl.extractResponseFromRedirectUri(redirectedUri); final String expected = "code=AAABAAAAiL9Kn2Z27UubvWFPbm0gLSXKVsoCQ5SqteFtDHVxXA8fd44gIaK71" + "juLqGyAA&session_state=10f521b6-41a9-41ba-8faa-8645e74d5123"; Assert.assertEquals(expected, actual); }