Package com.gistlabs.mechanize.impl

Examples of com.gistlabs.mechanize.impl.MechanizeAgent.doRequest()


  /** Tests if google stores two cookies. It uses a special link to prevent google form choosing a different homepage depending on the ip being used. */
  @Test
  public void testGoogleComSendsTwoCookies() {
    MechanizeAgent agent = new MechanizeAgent();

    agent.
    doRequest("https://www.google.co.uk/setprefdomain?prefdom=US&sig=0_iEtQ0487gjqkcvDjBk5XCH1G_WU%3D").
    addHeader("Accept-Language", "en-US").
    get();
    assertEquals(2, agent.cookies().getCount());
    assertNotNull(agent.cookies().get("NID", ".google.co.uk"));
View Full Code Here


  }

  @Test
  public void testGoogleApi() throws JSONException {
    MechanizeAgent agent = new MechanizeAgent();
    JsonDocument json = agent.doRequest(googleUrl).add("shortUrl", shortUrl).add("projection", "FULL").get();
    //String debug = json.asString();

    assertEquals(longUrl, json.getRoot().find("longUrl").getValue());

    //FRAGILE TEST no longer works
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.