Added more unit tests

This commit is contained in:
cyian-1756 2018-09-13 07:27:39 -04:00
parent d945a51c4d
commit f8bce9e288

View File

@ -5,6 +5,9 @@ import java.net.URL;
import java.util.List; import java.util.List;
import com.rarchives.ripme.ripper.rippers.TsuminoRipper; import com.rarchives.ripme.ripper.rippers.TsuminoRipper;
import com.rarchives.ripme.utils.RipUtils;
import org.jsoup.nodes.Document;
public class TsuminoRipperTest extends RippersTest { public class TsuminoRipperTest extends RippersTest {
public void testTsuminoRipper() throws IOException { public void testTsuminoRipper() throws IOException {
@ -14,14 +17,21 @@ public class TsuminoRipperTest extends RippersTest {
public void testTagBlackList() throws IOException { public void testTagBlackList() throws IOException {
TsuminoRipper ripper = new TsuminoRipper(new URL("http://www.tsumino.com/Book/Info/42882/chaldea-maid-")); TsuminoRipper ripper = new TsuminoRipper(new URL("http://www.tsumino.com/Book/Info/42882/chaldea-maid-"));
Document doc = ripper.getFirstPage();
List<String> tagsOnPage = ripper.getTags(doc);
String[] tags1 = {"test", "one", "Blowjob"}; String[] tags1 = {"test", "one", "Blowjob"};
String blacklistedTag = ripper.checkTags(ripper.getFirstPage(), tags1); String blacklistedTag = RipUtils.checkTags(tags1, tagsOnPage);
assertEquals("blowjob", blacklistedTag); assertEquals("blowjob", blacklistedTag);
// Test a tag with spaces // Test a tag with spaces
String[] tags2 = {"test", "one", "Full Color"}; String[] tags2 = {"test", "one", "Full Color"};
blacklistedTag = ripper.checkTags(ripper.getFirstPage(), tags2); blacklistedTag = RipUtils.checkTags(tags2, tagsOnPage);
assertEquals("full color", blacklistedTag); assertEquals("full color", blacklistedTag);
// Test a album with no blacklisted tags
String[] tags3 = {"nothing", "one", "null"};
blacklistedTag = RipUtils.checkTags(tags3, tagsOnPage);
assertNull(blacklistedTag);
} }
} }