@@ -48,7 +48,7 @@ void testGetComments() throws IOException, ExtractionException {
4848
4949 @ Test
5050 void testGetCommentsFromCommentsInfo () throws IOException , ExtractionException {
51- final String comment = "great video" ;
51+ final String comment = "Thanks for creating such an informative video" ;
5252
5353 final CommentsInfo commentsInfo =
5454 CommentsInfo .getInfo ("https://framatube.org/w/kkGMgK9ZtnKfYAgnEtQxbv" );
@@ -69,33 +69,33 @@ void testGetCommentsFromCommentsInfo() throws IOException, ExtractionException {
6969
7070 @ Test
7171 void testGetCommentsAllData () throws IOException , ExtractionException {
72- InfoItemsPage <CommentsInfoItem > comments = extractor .getInitialPage ();
73- for (CommentsInfoItem c : comments .getItems ()) {
74- assertFalse (Utils .isBlank (c .getUploaderUrl ()));
75- assertFalse (Utils .isBlank (c .getUploaderName ()));
76- assertFalse (Utils .isBlank (c .getUploaderAvatarUrl ()));
77- assertFalse (Utils .isBlank (c .getCommentId ()));
78- assertFalse (Utils .isBlank (c .getCommentText ().getContent ()));
79- assertFalse (Utils .isBlank (c .getName ()));
80- assertFalse (Utils .isBlank (c .getTextualUploadDate ()));
81- assertFalse (Utils .isBlank (c .getThumbnailUrl ()));
82- assertFalse (Utils .isBlank (c .getUrl ()));
83- assertEquals (-1 , c .getLikeCount ());
84- assertTrue (Utils .isBlank (c .getTextualLikeCount ()));
85- }
72+ extractor .getInitialPage ()
73+ .getItems ()
74+ .forEach (commentsInfoItem -> {
75+ assertFalse (Utils .isBlank (commentsInfoItem .getUploaderUrl ()));
76+ assertFalse (Utils .isBlank (commentsInfoItem .getUploaderName ()));
77+ assertFalse (Utils .isBlank (commentsInfoItem .getUploaderAvatarUrl ()));
78+ assertFalse (Utils .isBlank (commentsInfoItem .getCommentId ()));
79+ assertFalse (Utils .isBlank (commentsInfoItem .getCommentText ().getContent ()));
80+ assertFalse (Utils .isBlank (commentsInfoItem .getName ()));
81+ assertFalse (Utils .isBlank (commentsInfoItem .getTextualUploadDate ()));
82+ assertFalse (Utils .isBlank (commentsInfoItem .getThumbnailUrl ()));
83+ assertFalse (Utils .isBlank (commentsInfoItem .getUrl ()));
84+ assertEquals (-1 , commentsInfoItem .getLikeCount ());
85+ assertTrue (Utils .isBlank (commentsInfoItem .getTextualLikeCount ()));
86+ });
8687 }
8788
88- private boolean findInComments (InfoItemsPage <CommentsInfoItem > comments , String comment ) {
89+ private boolean findInComments (final InfoItemsPage <CommentsInfoItem > comments ,
90+ final String comment ) {
8991 return findInComments (comments .getItems (), comment );
9092 }
9193
92- private boolean findInComments (List <CommentsInfoItem > comments , String comment ) {
93- for (CommentsInfoItem c : comments ) {
94- if (c .getCommentText ().getContent ().contains (comment )) {
95- return true ;
96- }
97- }
98- return false ;
94+ private boolean findInComments (final List <CommentsInfoItem > comments ,
95+ final String comment ) {
96+ return comments .stream ()
97+ .anyMatch (commentsInfoItem ->
98+ commentsInfoItem .getCommentText ().getContent ().contains (comment ));
9999 }
100100 }
101101
0 commit comments