Skip to content

Commit

Permalink
fix_duplicate_method
Browse files Browse the repository at this point in the history
  • Loading branch information
redouane59 committed Sep 9, 2020
1 parent 57b58a4 commit 9cc5bc3
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,6 @@ public interface ITwitterClientV1 {
*/
RateLimitStatus getRateLimitStatus();

/**
* Get the last tweets of a user calling https://api.twitter.com/1.1/statuses/
*
* @param userId the id of the user
* @param count the number of tweets
* @return a list of the user last tweets
*/
List<Tweet> getUserLastTweets(String userId, int count);

/**
* Get the most recent Tweets liked calling https://api.twitter.com/1.1/favorites/list.json
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,6 @@ public List<User> getUsersFromUserIds(List<String> userIds) {
return result.stream().map(userData -> UserV2.builder().data(userData).build()).collect(Collectors.toList());
}

@Override
public List<Tweet> getUserLastTweets(String userId, int count) {
String url = this.getUrlHelper().getUserTweetsUrl(userId, count);
TweetV1[] response = this.requestHelperV2.getRequest(url, TweetV1[].class).orElseThrow(NoSuchElementException::new);
return List.of(response);
}

@Override
public RateLimitStatus getRateLimitStatus() {
String url = URLHelper.RATE_LIMIT_URL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,23 +107,7 @@ public void testGetRetweetersId() {
String tweetId = "1078358350000205824";
assertTrue(twitterClient.getRetweetersId(tweetId).size() > 10);
}

@Test
public void testGetLastTweetByUserName() {
String userName = "RedTheOne";
List<Tweet> response = twitterClient.getUserLastTweets(userName, 2);
assertTrue(response.get(0).getLang().equals("fr")
|| response.get(1).getLang().equals("fr"));
}

@Test
public void testGetLastTweetByUserId() {
String userId = "92073489";
List<Tweet> response = twitterClient.getUserLastTweets(userId, 3);
assertTrue(response.get(0).getLang().equals("fr")
|| response.get(1).getLang().equals("fr"));
}


@Test
public void testGetOauth1Token() {
TwitterClient.TWITTER_CREDENTIALS.setAccessToken("");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public void testSearchTweets7daysWithNexTokenAndCount() {
public void testGetTweetType() {
assertEquals(TweetType.QUOTED, twitterClient.getTweet("1267115291991068673").getTweetType());
assertEquals(TweetType.REPLIED_TO, twitterClient.getTweet("1267132388632604673").getTweetType());
assertEquals(null, twitterClient.getTweet("1267010053040672768").getTweetType());
assertEquals(TweetType.DEFAULT, twitterClient.getTweet("1267010053040672768").getTweetType());
}

@Test
Expand Down

0 comments on commit 9cc5bc3

Please sign in to comment.