mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2025-04-29 00:10:35 +05:30
Remove public modifier from tests
This commit is contained in:
parent
e475b2971b
commit
625e9f96d2
@ -26,8 +26,7 @@ import java.util.List;
|
||||
/**
|
||||
* Test for {@link YoutubeSubscriptionExtractor}
|
||||
*/
|
||||
public class YoutubeSubscriptionExtractorTest {
|
||||
|
||||
class YoutubeSubscriptionExtractorTest {
|
||||
|
||||
private static YoutubeSubscriptionExtractor subscriptionExtractor;
|
||||
private static LinkHandlerFactory urlHandler;
|
||||
@ -41,7 +40,7 @@ public class YoutubeSubscriptionExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFromInputStream() throws Exception {
|
||||
void testFromInputStream() throws Exception {
|
||||
final List<SubscriptionItem> subscriptionItems = subscriptionExtractor.fromInputStream(
|
||||
new FileInputStream(resolveTestResource("youtube_takeout_import_test.json")));
|
||||
assertEquals(7, subscriptionItems.size());
|
||||
@ -55,14 +54,14 @@ public class YoutubeSubscriptionExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmptySourceException() throws Exception {
|
||||
void testEmptySourceException() throws Exception {
|
||||
final List<SubscriptionItem> items = subscriptionExtractor.fromInputStream(
|
||||
new ByteArrayInputStream("[]".getBytes(StandardCharsets.UTF_8)));
|
||||
assertTrue(items.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSubscriptionWithEmptyTitleInSource() throws Exception {
|
||||
void testSubscriptionWithEmptyTitleInSource() throws Exception {
|
||||
final String source = "[{\"snippet\":{\"resourceId\":{\"channelId\":\"UCEOXxzW2vU0P-0THehuIIeg\"}}}]";
|
||||
final List<SubscriptionItem> items = subscriptionExtractor.fromInputStream(
|
||||
new ByteArrayInputStream(source.getBytes(StandardCharsets.UTF_8)));
|
||||
@ -74,7 +73,7 @@ public class YoutubeSubscriptionExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSubscriptionWithInvalidUrlInSource() throws Exception {
|
||||
void testSubscriptionWithInvalidUrlInSource() throws Exception {
|
||||
final String source = "[{\"snippet\":{\"resourceId\":{\"channelId\":\"gibberish\"},\"title\":\"name1\"}}," +
|
||||
"{\"snippet\":{\"resourceId\":{\"channelId\":\"UCEOXxzW2vU0P-0THehuIIeg\"},\"title\":\"name2\"}}]";
|
||||
final List<SubscriptionItem> items = subscriptionExtractor.fromInputStream(
|
||||
@ -87,8 +86,8 @@ public class YoutubeSubscriptionExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidSourceException() {
|
||||
List<String> invalidList = Arrays.asList(
|
||||
void testInvalidSourceException() {
|
||||
final List<String> invalidList = Arrays.asList(
|
||||
"<xml><notvalid></notvalid></xml>",
|
||||
"<opml><notvalid></notvalid></opml>",
|
||||
"{\"a\":\"b\"}",
|
||||
@ -100,13 +99,14 @@ public class YoutubeSubscriptionExtractorTest {
|
||||
"\uD83D\uDC28\uD83D\uDC28\uD83D\uDC28",
|
||||
"gibberish");
|
||||
|
||||
for (String invalidContent : invalidList) {
|
||||
for (final String invalidContent : invalidList) {
|
||||
try {
|
||||
byte[] bytes = invalidContent.getBytes(StandardCharsets.UTF_8);
|
||||
final byte[] bytes = invalidContent.getBytes(StandardCharsets.UTF_8);
|
||||
subscriptionExtractor.fromInputStream(new ByteArrayInputStream(bytes));
|
||||
fail("Extracting from \"" + invalidContent + "\" didn't throw an exception");
|
||||
} catch (final Exception e) {
|
||||
boolean correctType = e instanceof SubscriptionExtractor.InvalidSourceException;
|
||||
final boolean correctType =
|
||||
e instanceof SubscriptionExtractor.InvalidSourceException;
|
||||
if (!correctType) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -117,7 +117,7 @@ public class YoutubeSubscriptionExtractorTest {
|
||||
|
||||
private static void assertSubscriptionItems(final List<SubscriptionItem> subscriptionItems)
|
||||
throws Exception {
|
||||
assertTrue(subscriptionItems.size() > 0);
|
||||
assertTrue(!subscriptionItems.isEmpty());
|
||||
|
||||
for (final SubscriptionItem item : subscriptionItems) {
|
||||
assertNotNull(item.getName());
|
||||
@ -128,7 +128,7 @@ public class YoutubeSubscriptionExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void fromZipInputStream() throws Exception {
|
||||
void fromZipInputStream() throws Exception {
|
||||
final List<String> zipPaths = Arrays.asList(
|
||||
"youtube_takeout_import_test_1.zip",
|
||||
"youtube_takeout_import_test_2.zip"
|
||||
@ -144,13 +144,13 @@ public class YoutubeSubscriptionExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void fromCsvInputStream() throws Exception {
|
||||
void fromCsvInputStream() throws Exception {
|
||||
final List<String> csvPaths = Arrays.asList(
|
||||
"youtube_takeout_import_test_1.csv",
|
||||
"youtube_takeout_import_test_2.csv"
|
||||
);
|
||||
|
||||
for (String path : csvPaths)
|
||||
for (final String path : csvPaths)
|
||||
{
|
||||
final File file = resolveTestResource(path);
|
||||
final FileInputStream fileInputStream = new FileInputStream(file);
|
||||
|
Loading…
x
Reference in New Issue
Block a user