2626/**
2727 * Test for {@link YoutubeSubscriptionExtractor}
2828 */
29- public class YoutubeSubscriptionExtractorTest {
30-
29+ class YoutubeSubscriptionExtractorTest {
3130
3231 private static YoutubeSubscriptionExtractor subscriptionExtractor ;
3332 private static LinkHandlerFactory urlHandler ;
@@ -41,7 +40,7 @@ public static void setupClass() {
4140 }
4241
4342 @ Test
44- public void testFromInputStream () throws Exception {
43+ void testFromInputStream () throws Exception {
4544 final List <SubscriptionItem > subscriptionItems = subscriptionExtractor .fromInputStream (
4645 new FileInputStream (resolveTestResource ("youtube_takeout_import_test.json" )));
4746 assertEquals (7 , subscriptionItems .size ());
@@ -55,14 +54,14 @@ public void testFromInputStream() throws Exception {
5554 }
5655
5756 @ Test
58- public void testEmptySourceException () throws Exception {
57+ void testEmptySourceException () throws Exception {
5958 final List <SubscriptionItem > items = subscriptionExtractor .fromInputStream (
6059 new ByteArrayInputStream ("[]" .getBytes (StandardCharsets .UTF_8 )));
6160 assertTrue (items .isEmpty ());
6261 }
6362
6463 @ Test
65- public void testSubscriptionWithEmptyTitleInSource () throws Exception {
64+ void testSubscriptionWithEmptyTitleInSource () throws Exception {
6665 final String source = "[{\" snippet\" :{\" resourceId\" :{\" channelId\" :\" UCEOXxzW2vU0P-0THehuIIeg\" }}}]" ;
6766 final List <SubscriptionItem > items = subscriptionExtractor .fromInputStream (
6867 new ByteArrayInputStream (source .getBytes (StandardCharsets .UTF_8 )));
@@ -74,7 +73,7 @@ public void testSubscriptionWithEmptyTitleInSource() throws Exception {
7473 }
7574
7675 @ Test
77- public void testSubscriptionWithInvalidUrlInSource () throws Exception {
76+ void testSubscriptionWithInvalidUrlInSource () throws Exception {
7877 final String source = "[{\" snippet\" :{\" resourceId\" :{\" channelId\" :\" gibberish\" },\" title\" :\" name1\" }}," +
7978 "{\" snippet\" :{\" resourceId\" :{\" channelId\" :\" UCEOXxzW2vU0P-0THehuIIeg\" },\" title\" :\" name2\" }}]" ;
8079 final List <SubscriptionItem > items = subscriptionExtractor .fromInputStream (
@@ -87,8 +86,8 @@ public void testSubscriptionWithInvalidUrlInSource() throws Exception {
8786 }
8887
8988 @ Test
90- public void testInvalidSourceException () {
91- List <String > invalidList = Arrays .asList (
89+ void testInvalidSourceException () {
90+ final List <String > invalidList = Arrays .asList (
9291 "<xml><notvalid></notvalid></xml>" ,
9392 "<opml><notvalid></notvalid></opml>" ,
9493 "{\" a\" :\" b\" }" ,
@@ -100,13 +99,14 @@ public void testInvalidSourceException() {
10099 "\uD83D \uDC28 \uD83D \uDC28 \uD83D \uDC28 " ,
101100 "gibberish" );
102101
103- for (String invalidContent : invalidList ) {
102+ for (final String invalidContent : invalidList ) {
104103 try {
105- byte [] bytes = invalidContent .getBytes (StandardCharsets .UTF_8 );
104+ final byte [] bytes = invalidContent .getBytes (StandardCharsets .UTF_8 );
106105 subscriptionExtractor .fromInputStream (new ByteArrayInputStream (bytes ));
107106 fail ("Extracting from \" " + invalidContent + "\" didn't throw an exception" );
108107 } catch (final Exception e ) {
109- boolean correctType = e instanceof SubscriptionExtractor .InvalidSourceException ;
108+ final boolean correctType =
109+ e instanceof SubscriptionExtractor .InvalidSourceException ;
110110 if (!correctType ) {
111111 e .printStackTrace ();
112112 }
@@ -117,7 +117,7 @@ public void testInvalidSourceException() {
117117
118118 private static void assertSubscriptionItems (final List <SubscriptionItem > subscriptionItems )
119119 throws Exception {
120- assertTrue (subscriptionItems .size () > 0 );
120+ assertTrue (! subscriptionItems .isEmpty () );
121121
122122 for (final SubscriptionItem item : subscriptionItems ) {
123123 assertNotNull (item .getName ());
@@ -128,7 +128,7 @@ private static void assertSubscriptionItems(final List<SubscriptionItem> subscri
128128 }
129129
130130 @ Test
131- public void fromZipInputStream () throws Exception {
131+ void fromZipInputStream () throws Exception {
132132 final List <String > zipPaths = Arrays .asList (
133133 "youtube_takeout_import_test_1.zip" ,
134134 "youtube_takeout_import_test_2.zip"
@@ -144,13 +144,13 @@ public void fromZipInputStream() throws Exception {
144144 }
145145
146146 @ Test
147- public void fromCsvInputStream () throws Exception {
147+ void fromCsvInputStream () throws Exception {
148148 final List <String > csvPaths = Arrays .asList (
149149 "youtube_takeout_import_test_1.csv" ,
150150 "youtube_takeout_import_test_2.csv"
151151 );
152152
153- for (String path : csvPaths )
153+ for (final String path : csvPaths )
154154 {
155155 final File file = resolveTestResource (path );
156156 final FileInputStream fileInputStream = new FileInputStream (file );
0 commit comments