From 9cc5bc3bd90e228bec33d25734accc3768fd96cf Mon Sep 17 00:00:00 2001 From: redouane59 Date: Wed, 9 Sep 2020 22:23:40 +0200 Subject: [PATCH] fix_duplicate_method --- .../redouane59/twitter/ITwitterClientV1.java | 9 --------- .../redouane59/twitter/TwitterClient.java | 7 ------- .../twitter/nrt/ITwitterClientV1Test.java | 18 +----------------- .../twitter/nrt/ITwitterClientV2Test.java | 2 +- 4 files changed, 2 insertions(+), 34 deletions(-) diff --git a/src/main/java/com/github/redouane59/twitter/ITwitterClientV1.java b/src/main/java/com/github/redouane59/twitter/ITwitterClientV1.java index fbd80cc6..e5d46dec 100644 --- a/src/main/java/com/github/redouane59/twitter/ITwitterClientV1.java +++ b/src/main/java/com/github/redouane59/twitter/ITwitterClientV1.java @@ -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 getUserLastTweets(String userId, int count); - /** * Get the most recent Tweets liked calling https://api.twitter.com/1.1/favorites/list.json * diff --git a/src/main/java/com/github/redouane59/twitter/TwitterClient.java b/src/main/java/com/github/redouane59/twitter/TwitterClient.java index 76a6f146..0d9957ec 100644 --- a/src/main/java/com/github/redouane59/twitter/TwitterClient.java +++ b/src/main/java/com/github/redouane59/twitter/TwitterClient.java @@ -265,13 +265,6 @@ public List getUsersFromUserIds(List userIds) { return result.stream().map(userData -> UserV2.builder().data(userData).build()).collect(Collectors.toList()); } - @Override - public List 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; diff --git a/src/test/java/com/github/redouane59/twitter/nrt/ITwitterClientV1Test.java b/src/test/java/com/github/redouane59/twitter/nrt/ITwitterClientV1Test.java index 17a12a87..3c49df8a 100644 --- a/src/test/java/com/github/redouane59/twitter/nrt/ITwitterClientV1Test.java +++ b/src/test/java/com/github/redouane59/twitter/nrt/ITwitterClientV1Test.java @@ -107,23 +107,7 @@ public void testGetRetweetersId() { String tweetId = "1078358350000205824"; assertTrue(twitterClient.getRetweetersId(tweetId).size() > 10); } - - @Test - public void testGetLastTweetByUserName() { - String userName = "RedTheOne"; - List 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 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(""); diff --git a/src/test/java/com/github/redouane59/twitter/nrt/ITwitterClientV2Test.java b/src/test/java/com/github/redouane59/twitter/nrt/ITwitterClientV2Test.java index b6197cbc..4ca9a7a9 100644 --- a/src/test/java/com/github/redouane59/twitter/nrt/ITwitterClientV2Test.java +++ b/src/test/java/com/github/redouane59/twitter/nrt/ITwitterClientV2Test.java @@ -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