@Test public void testInjectToken() throws Exception { HttpURLConnection conn = Mockito.mock(HttpURLConnection.class); AuthenticatedURL.Token token = new AuthenticatedURL.Token(); token.set("foo"); AuthenticatedURL.injectToken(conn, token); Mockito.verify(conn).addRequestProperty(Mockito.eq("Cookie"), Mockito.anyString()); }
public static void injectToken(HttpURLConnection conn, Token token) { String t = token.token; if (t != null) { if (!t.startsWith("\"")) { t = "\"" + t + "\""; } conn.addRequestProperty("Cookie", AUTH_COOKIE_EQ + t); } }
AuthenticatedURL { public static void injectToken(HttpURLConnection conn, Token token) { String t = token.token; if (t != null) { if (!t.startsWith("\"")) { t = "\"" + t + "\""; } conn.addRequestProperty("Cookie", AUTH_COOKIE_EQ + t); } } }
AuthenticatedURL { public static void injectToken(HttpURLConnection conn, Token token) { String t = token.token; if (t != null) { if (!t.startsWith("\"")) { t = "\"" + t + "\""; } conn.addRequestProperty("Cookie", AUTH_COOKIE_EQ + t); } } AuthenticatedURL();  AuthenticatedURL(Authenticator authenticator);  AuthenticatedURL(Authenticator authenticator,
                          ConnectionConfigurator connConfigurator); }
AuthenticatedURL { public static void injectToken(HttpURLConnection conn, Token token) { String t = token.token; if (t != null) { if (!t.startsWith("\"")) { t = "\"" + t + "\""; } conn.addRequestProperty("Cookie", AUTH_COOKIE_EQ + t); } } AuthenticatedURL();  AuthenticatedURL(Authenticator authenticator);  AuthenticatedURL(Authenticator authenticator,
                          ConnectionConfigurator connConfigurator); static void setDefaultAuthenticator(Class<? extends Authenticator> authenticator); static Class<? extends Authenticator> getDefaultAuthenticator(); HttpURLConnection openConnection(URL url, Token token); static void injectToken(HttpURLConnection conn, Token token); static void extractToken(HttpURLConnection conn, Token token); }
AuthenticatedURL { public static void injectToken(HttpURLConnection conn, Token token) { String t = token.token; if (t != null) { if (!t.startsWith("\"")) { t = "\"" + t + "\""; } conn.addRequestProperty("Cookie", AUTH_COOKIE_EQ + t); } } AuthenticatedURL();  AuthenticatedURL(Authenticator authenticator);  AuthenticatedURL(Authenticator authenticator,
                          ConnectionConfigurator connConfigurator); static void setDefaultAuthenticator(Class<? extends Authenticator> authenticator); static Class<? extends Authenticator> getDefaultAuthenticator(); HttpURLConnection openConnection(URL url, Token token); static void injectToken(HttpURLConnection conn, Token token); static void extractToken(HttpURLConnection conn, Token token); static final String AUTH_COOKIE; }