Skip to content

Commit fa444c8

Browse files
committed
Remove assertations of exception messages
1 parent ec50570 commit fa444c8

1 file changed

Lines changed: 11 additions & 17 deletions

File tree

extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractorTest.java

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
package org.schabi.newpipe.extractor.services.youtube;
22

3-
import com.grack.nanojson.JsonArray;
4-
import com.grack.nanojson.JsonObject;
5-
import com.grack.nanojson.JsonParser;
63
import org.junit.BeforeClass;
74
import org.junit.Test;
85
import org.schabi.newpipe.downloader.DownloaderFactory;
96
import org.schabi.newpipe.downloader.DownloaderTestImpl;
10-
import org.schabi.newpipe.extractor.Extractor;
117
import org.schabi.newpipe.extractor.NewPipe;
128
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
139
import org.schabi.newpipe.extractor.exceptions.AccountTerminatedException;
@@ -16,7 +12,6 @@
1612
import org.schabi.newpipe.extractor.exceptions.ParsingException;
1713
import org.schabi.newpipe.extractor.services.BaseChannelExtractorTest;
1814
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeChannelExtractor;
19-
import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeChannelLinkHandlerFactory;
2015

2116
import java.io.IOException;
2217
import java.util.Random;
@@ -59,83 +54,82 @@ public void nonExistentFetch() throws Exception {
5954

6055
@Test(expected = AccountTerminatedException.class)
6156
public void accountTerminatedTOSFetch() throws Exception {
57+
// "This account has been terminated for a violation of YouTube's Terms of Service."
6258
final ChannelExtractor extractor =
6359
YouTube.getChannelExtractor("https://www.youtube.com/channel/UCTGjY2I-ZUGnwVoWAGRd7XQ");
6460
try {
6561
extractor.fetchPage();
6662
} catch (AccountTerminatedException e) {
67-
assertEquals(e.getMessage(),
68-
"This account has been terminated for a violation of YouTube's Terms of Service.");
6963
assertEquals(e.getReason(), AccountTerminatedException.Reason.VIOLATION);
7064
throw e;
7165
}
7266
}
7367

7468
@Test(expected = AccountTerminatedException.class)
7569
public void accountTerminatedCommunityFetch() throws Exception {
70+
// "This account has been terminated for violating YouTube's Community Guidelines."
7671
final ChannelExtractor extractor =
7772
YouTube.getChannelExtractor("https://www.youtube.com/channel/UC0AuOxCr9TZ0TtEgL1zpIgA");
7873
try {
7974
extractor.fetchPage();
8075
} catch (AccountTerminatedException e) {
81-
assertEquals(e.getMessage(),
82-
"This account has been terminated for violating YouTube's Community Guidelines.");
8376
assertEquals(e.getReason(), AccountTerminatedException.Reason.VIOLATION);
8477
throw e;
8578
}
8679
}
8780

8881
@Test(expected = AccountTerminatedException.class)
8982
public void accountTerminatedHateFetch() throws Exception {
83+
// "This account has been terminated due to multiple or severe violations
84+
// of YouTube's policy prohibiting hate speech."
9085
final ChannelExtractor extractor =
9186
YouTube.getChannelExtractor("https://www.youtube.com/channel/UCPWXIOPK-9myzek6jHR5yrg");
9287
try {
9388
extractor.fetchPage();
9489
} catch (AccountTerminatedException e) {
95-
assertTrue(e.getMessage().contains(
96-
"This account has been terminated due to multiple or severe violations of YouTube's policy prohibiting hate speech."));
9790
assertEquals(e.getReason(), AccountTerminatedException.Reason.VIOLATION);
9891
throw e;
9992
}
10093
}
10194

10295
@Test(expected = AccountTerminatedException.class)
10396
public void accountTerminatedBullyFetch() throws Exception {
97+
// "This account has been terminated due to multiple or severe violations
98+
// of YouTube's policy prohibiting content designed to harass, bully or threaten."
10499
final ChannelExtractor extractor =
105100
YouTube.getChannelExtractor("https://youtube.com/channel/UCB1o7_gbFp2PLsamWxFenBg");
106101
try {
107102
extractor.fetchPage();
108103
} catch (AccountTerminatedException e) {
109-
assertEquals(e.getMessage(),
110-
"This account has been terminated due to multiple or severe violations of YouTube's policy prohibiting content designed to harass, bully or threaten.");
111104
assertEquals(e.getReason(), AccountTerminatedException.Reason.VIOLATION);
112105
throw e;
113106
}
114107
}
115108

116109
@Test(expected = AccountTerminatedException.class)
117110
public void accountTerminatedSpamFetch() throws Exception {
111+
// "This account has been terminated due to multiple or severe violations
112+
// of YouTube's policy against spam, deceptive practices and misleading content
113+
// or other Terms of Service violations."
118114
final ChannelExtractor extractor =
119115
YouTube.getChannelExtractor("https://www.youtube.com/channel/UCoaO4U_p7G7AwalqSbGCZOA");
120116
try {
121117
extractor.fetchPage();
122118
} catch (AccountTerminatedException e) {
123-
assertEquals(e.getMessage(),
124-
"This account has been terminated due to multiple or severe violations of YouTube's policy against spam, deceptive practices and misleading content or other Terms of Service violations.");
125119
assertEquals(e.getReason(), AccountTerminatedException.Reason.VIOLATION);
126120
throw e;
127121
}
128122
}
129123

130124
@Test(expected = AccountTerminatedException.class)
131125
public void accountTerminatedCopyrightFetch() throws Exception {
126+
// "This account has been terminated because we received multiple third-party claims
127+
// of copyright infringement regarding material that the user posted."
132128
final ChannelExtractor extractor =
133129
YouTube.getChannelExtractor("https://www.youtube.com/channel/UCpExuV8qJMfCaSQNL1YG6bQ");
134130
try {
135131
extractor.fetchPage();
136132
} catch (AccountTerminatedException e) {
137-
assertEquals(e.getMessage(),
138-
"This account has been terminated because we received multiple third-party claims of copyright infringement regarding material that the user posted.");
139133
assertEquals(e.getReason(), AccountTerminatedException.Reason.VIOLATION);
140134
throw e;
141135
}

0 commit comments

Comments
 (0)