Package net.unto.twitter.methods

Examples of net.unto.twitter.methods.Request


  }

  @Test
  public void testUpdateDeliveryDeviceRequestUrl() {
    Api api = Api.builder().username("test").password("test").build();
    Request requestNone = api.updateDeliveryDevice(Device.NONE).build();
    assertEquals("http://twitter.com:80/account/update_delivery_device.json",
        requestNone.toString());
    assertHasParameter(requestNone.toUrl(), "device", "none");
    Request requestIm = api.updateDeliveryDevice(Device.IM).build();
    assertEquals("http://twitter.com:80/account/update_delivery_device.json",
        requestIm.toString());
    assertHasParameter(requestIm.toUrl(), "device", "im");
    Request requestSms = api.updateDeliveryDevice(Device.SMS).build();
    assertEquals("http://twitter.com:80/account/update_delivery_device.json",
        requestSms.toString());
    assertHasParameter(requestSms.toUrl(), "device", "sms");
  }
View Full Code Here


  @Test
  public void testUpdateProfileBackgroundImageRequestUrl() throws IOException {
    Api api = Api.builder().username("test").password("test").build();
    File file = new File(TEST_DATA_DIR, "profile_background_image.png");
    Request request = api.updateProfileBackgroundImage(file).build();
    assertEquals(
        "http://twitter.com:80/account/update_profile_background_image.json",
        request.toString());
    byte[] bytes = FileUtils.readFileToByteArray(file);
    assertHasPart(request.toUrl(), "image", "profile_background_image.png", bytes, "image/png", FilePart.DEFAULT_CHARSET);
  }
View Full Code Here

  }

  @Test
  public void testUpdateProfileColorsRequestUrl() {
    Api api = Api.builder().username("test").password("test").build();
    Request request = api.updateProfileColors().profileBackgroundColor("FFF")
        .profileTextColor("000").profileLinkColor("0000CC")
        .profileSidebarFillColor("CCCCCC").profileSidebarBorderColor("333333")
        .build();
    assertEquals("http://twitter.com:80/account/update_profile_colors.json",
        request.toString());
    assertHasParameter(request.toUrl(), "profile_background_color", "FFF");
    assertHasParameter(request.toUrl(), "profile_text_color", "000");
    assertHasParameter(request.toUrl(), "profile_link_color", "0000CC");
    assertHasParameter(request.toUrl(), "profile_sidebar_fill_color", "CCCCCC");
    assertHasParameter(request.toUrl(), "profile_sidebar_border_color",
        "333333");
  }
View Full Code Here

  @Test
  public void testUpdateProfileImageRequestUrl() throws IOException {
    Api api = Api.builder().username("test").password("test").build();
    File file = new File(TEST_DATA_DIR, "profile_image.png");
    Request request = api.updateProfileImage(file).build();
    assertEquals("http://twitter.com:80/account/update_profile_image.json",
        request.toString());
    byte[] bytes = FileUtils.readFileToByteArray(file);
    assertHasPart(request.toUrl(), "image", "profile_image.png", bytes, "image/png", FilePart.DEFAULT_CHARSET);
  }
View Full Code Here

  }

  @Test
  public void testUpdateProfileRequestUrl() {
    Api api = Api.builder().username("test").password("test").build();
    Request request = api.updateProfile().name("DeWitt Clinton").email(
        "dewitt@unto.net").url("http://unto.net/")
        .location("San Francisco, CA").description("...").build();
    assertEquals("http://twitter.com:80/account/update_profile.json", request
        .toString());
    assertHasParameter(request.toUrl(), "name", "DeWitt Clinton");
    assertHasParameter(request.toUrl(), "email", "dewitt@unto.net");
    assertHasParameter(request.toUrl(), "url", "http://unto.net/");
    assertHasParameter(request.toUrl(), "location", "San Francisco, CA");
    assertHasParameter(request.toUrl(), "description", "...");
  }
View Full Code Here

  }

  @Test
  public void testUpdateStatusRequestUrl() {
    Api api = Api.builder().username("test").password("test").build();
    Request request = api.updateStatus("Hello, Twitter!").inReplyToStatusId(
        12345).build();
    assertEquals("http://twitter.com:80/statuses/update.json", request
        .toString());
    assertHasParameter(request.toUrl(), "status", "Hello, Twitter!");
    assertHasParameter(request.toUrl(), "in_reply_to_status_id", "12345");
  }
View Full Code Here

  @Test
  public void testUserTimelineRequestUrl() {
    Api api = Api.builder().username("test").password("test").build();
    DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeZone.UTC);
    Request request = api.userTimeline().id("dewitt").count(10).page(1)
        .sinceId(12345).since(epoch).build();
    assertEquals("http://twitter.com:80/statuses/user_timeline/dewitt.json",
        request.toString());
    assertHasParameter(request.toUrl(), "count", "10");
    assertHasParameter(request.toUrl(), "page", "1");
    assertHasParameter(request.toUrl(), "since_id", "12345");
    assertHasParameter(request.toUrl(), "since",
        "Thu Jan 01 00:00:00 +0000 1970");
  }
View Full Code Here


  @Test
  public void testVerifyCredentialsRequestUrl() {
    Api api = Api.builder().username("test").password("test").build();
    Request request = api.verifyCredentials().build();
    assertEquals("http://twitter.com:80/account/verify_credentials.json",
        request.toString());
  }
View Full Code Here

  }

  @Test
  public void testModifiedHost() {
    Api api = Api.builder().host("example.com").build();
    Request request = api.publicTimeline().build();
    assertEquals("http://example.com:80/statuses/public_timeline.json",
                 request.toString());
  }
View Full Code Here

  }

  @Test
  public void testModifiedPort() {
    Api api = Api.builder().port(8080).build();
    Request request = api.publicTimeline().build();
    assertEquals("http://twitter.com:8080/statuses/public_timeline.json",
                 request.toString());
  }
View Full Code Here

TOP

Related Classes of net.unto.twitter.methods.Request

Copyright © 2018 www.massapicom. 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.