@Test
public void testExtractTokenOK() throws Exception {

  HttpURLConnection conn = Mockito.mock(HttpURLConnection.class);
  Mockito.when(conn.getResponseCode()).thenReturn(HttpURLConnection.HTTP_OK);
  String tokenStr = "foo";
  Map<String, List<String>> headers = new HashMap<String, List<String>>();
  List<String> cookies = new ArrayList<String>();
  cookies.add(AuthenticatedURL.AUTH_COOKIE + "=" + tokenStr);
  headers.put("Set-Cookie", cookies);
  Mockito.when(conn.getHeaderFields()).thenReturn(headers);
  AuthenticatedURL.Token token = new AuthenticatedURL.Token();
  AuthenticatedURL.extractToken(conn, token);
  Assert.assertEquals(tokenStr, token.toString());
}