Example #1
0
  @Test
  public void testGetRelationshipInfo() {
    Twitter jtwit = TwitterTest.newTestTwitter();
    Twitter_Users tu = new Twitter_Users(jtwit);
    List<User> users =
        tu.getRelationshipInfo(
            Arrays.asList("winterstein", "spoonmcguffin", "stephenfry", "jtwittest2"));
    User w = users.get(users.indexOf(new User("winterstein")));
    assert w.isFollowingYou();
    User jtwit2 = users.get(users.indexOf(new User("jtwittest2")));
    User fry = users.get(users.indexOf(new User("stephenfry")));

    boolean jtwitFollowsWinterstein = jtwit.isFollowing("winterstein");
    boolean jtwitFollowsFry = jtwit.isFollowing("stephenfry");
    if (!jtwitFollowsFry) {
      jtwit.follow("stephenfry");
    }
    User fryb = jtwit.users().show("stephenfry");

    //		boolean isf = jtwit.users().isFollower("winterstein", jtwit.getScreenName());
    //		assert isf;
    //		User w2 = jtwit.users().show("winterstein");
    //		assert w2.isFollowingYou(); comes back null?!

    assert fry.isFollowedByYou();
    assert fryb.isFollowedByYou();
    assert !fry.isFollowingYou();
    // this now returns null a lot!
    assert fryb.isFollowingYou() == null || !fryb.isFollowingYou();
  }
Example #2
0
  @Test
  public void testBlocks() {
    {
      //			OAuthSignpostClient client = new OAuthSignpostClient(
      //			OAuthSignpostClient.JTWITTER_OAUTH_KEY,
      //			OAuthSignpostClient.JTWITTER_OAUTH_SECRET,"oob");
      //	client.authorizeDesktop();
      //	String pin = client.askUser("The Pin?");
      //	System.out.println(pin);
      //	client.setAuthorizationCode(pin);
      //	String[] tokens = client.getAccessToken();
      //	System.out.println(tokens[0]+" "+tokens[1]);

      //			OAuthSignpostClient client = new OAuthSignpostClient(
      //			OAuthSignpostClient.JTWITTER_OAUTH_KEY,
      //			OAuthSignpostClient.JTWITTER_OAUTH_SECRET,
      //			token0, token1);
      //			Twitter jtwit = new Twitter(null, client);
      //			System.out.println(jtwit.getSelf());
      Twitter jtwit = TwitterTest.newTestTwitter();
      Twitter_Users ta = jtwit.users();
      List<Number> blocked = ta.getBlockedIds();
      System.out.println(blocked);
      List<User> users = ta.showById(blocked);
      System.out.println(users);
    }
  }