mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2025-04-28 16:00:33 +05:30
[PeerTube] Fix testGetCommentsFromCommentsInfo test of PeertubeCommentsExtractorTest.Default
The tested comment has been removed, so it couldn't be found in the comments list. This comment has been replaced by a new one from the current comments of the video. Also, in the parent class PeertubeCommentsExtractorTest, final has been used as much as possible and for-each loops of lists have been replaced by their forEach method or the Stream API, in order to simplify code.
This commit is contained in:
parent
5a9b6ed2e3
commit
80a6fc2c63
@ -48,7 +48,7 @@ public class PeertubeCommentsExtractorTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGetCommentsFromCommentsInfo() throws IOException, ExtractionException {
|
void testGetCommentsFromCommentsInfo() throws IOException, ExtractionException {
|
||||||
final String comment = "great video";
|
final String comment = "Thanks for creating such an informative video";
|
||||||
|
|
||||||
final CommentsInfo commentsInfo =
|
final CommentsInfo commentsInfo =
|
||||||
CommentsInfo.getInfo("https://framatube.org/w/kkGMgK9ZtnKfYAgnEtQxbv");
|
CommentsInfo.getInfo("https://framatube.org/w/kkGMgK9ZtnKfYAgnEtQxbv");
|
||||||
@ -69,33 +69,33 @@ public class PeertubeCommentsExtractorTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGetCommentsAllData() throws IOException, ExtractionException {
|
void testGetCommentsAllData() throws IOException, ExtractionException {
|
||||||
InfoItemsPage<CommentsInfoItem> comments = extractor.getInitialPage();
|
extractor.getInitialPage()
|
||||||
for (CommentsInfoItem c : comments.getItems()) {
|
.getItems()
|
||||||
assertFalse(Utils.isBlank(c.getUploaderUrl()));
|
.forEach(commentsInfoItem -> {
|
||||||
assertFalse(Utils.isBlank(c.getUploaderName()));
|
assertFalse(Utils.isBlank(commentsInfoItem.getUploaderUrl()));
|
||||||
assertFalse(Utils.isBlank(c.getUploaderAvatarUrl()));
|
assertFalse(Utils.isBlank(commentsInfoItem.getUploaderName()));
|
||||||
assertFalse(Utils.isBlank(c.getCommentId()));
|
assertFalse(Utils.isBlank(commentsInfoItem.getUploaderAvatarUrl()));
|
||||||
assertFalse(Utils.isBlank(c.getCommentText().getContent()));
|
assertFalse(Utils.isBlank(commentsInfoItem.getCommentId()));
|
||||||
assertFalse(Utils.isBlank(c.getName()));
|
assertFalse(Utils.isBlank(commentsInfoItem.getCommentText().getContent()));
|
||||||
assertFalse(Utils.isBlank(c.getTextualUploadDate()));
|
assertFalse(Utils.isBlank(commentsInfoItem.getName()));
|
||||||
assertFalse(Utils.isBlank(c.getThumbnailUrl()));
|
assertFalse(Utils.isBlank(commentsInfoItem.getTextualUploadDate()));
|
||||||
assertFalse(Utils.isBlank(c.getUrl()));
|
assertFalse(Utils.isBlank(commentsInfoItem.getThumbnailUrl()));
|
||||||
assertEquals(-1, c.getLikeCount());
|
assertFalse(Utils.isBlank(commentsInfoItem.getUrl()));
|
||||||
assertTrue(Utils.isBlank(c.getTextualLikeCount()));
|
assertEquals(-1, commentsInfoItem.getLikeCount());
|
||||||
}
|
assertTrue(Utils.isBlank(commentsInfoItem.getTextualLikeCount()));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean findInComments(InfoItemsPage<CommentsInfoItem> comments, String comment) {
|
private boolean findInComments(final InfoItemsPage<CommentsInfoItem> comments,
|
||||||
|
final String comment) {
|
||||||
return findInComments(comments.getItems(), comment);
|
return findInComments(comments.getItems(), comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean findInComments(List<CommentsInfoItem> comments, String comment) {
|
private boolean findInComments(final List<CommentsInfoItem> comments,
|
||||||
for (CommentsInfoItem c : comments) {
|
final String comment) {
|
||||||
if (c.getCommentText().getContent().contains(comment)) {
|
return comments.stream()
|
||||||
return true;
|
.anyMatch(commentsInfoItem ->
|
||||||
}
|
commentsInfoItem.getCommentText().getContent().contains(comment));
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user