refactored ehentai unit tests

This commit is contained in:
cyian-1756 2018-09-14 13:44:47 -04:00
parent 70799e39b9
commit 1ecef7356a

View File

@ -2,8 +2,10 @@ package com.rarchives.ripme.tst.ripper.rippers;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.util.List;
import com.rarchives.ripme.ripper.rippers.EHentaiRipper; import com.rarchives.ripme.ripper.rippers.EHentaiRipper;
import com.rarchives.ripme.utils.RipUtils;
public class EhentaiRipperTest extends RippersTest { public class EhentaiRipperTest extends RippersTest {
public void testEHentaiAlbum() throws IOException { public void testEHentaiAlbum() throws IOException {
@ -15,14 +17,15 @@ public class EhentaiRipperTest extends RippersTest {
public void testTagBlackList() throws IOException { public void testTagBlackList() throws IOException {
URL url = new URL("https://e-hentai.org/g/1228503/1a2f455f96/"); URL url = new URL("https://e-hentai.org/g/1228503/1a2f455f96/");
EHentaiRipper ripper = new EHentaiRipper(url); EHentaiRipper ripper = new EHentaiRipper(url);
List<String> tagsOnPage = ripper.getTags(ripper.getFirstPage());
// Test multiple blacklisted tags // Test multiple blacklisted tags
String[] tags = {"test", "one", "yuri"}; String[] tags = {"test", "one", "yuri"};
String blacklistedTag = ripper.checkTags(ripper.getFirstPage(), tags); String blacklistedTag = RipUtils.checkTags(tags, tagsOnPage);
assertEquals("yuri", blacklistedTag); assertEquals("yuri", blacklistedTag);
// test tags with spaces in them // test tags with spaces in them
String[] tags2 = {"test", "one", "midnight on mars"}; String[] tags2 = {"test", "one", "midnight on mars"};
blacklistedTag = ripper.checkTags(ripper.getFirstPage(), tags2); blacklistedTag = RipUtils.checkTags(tags2, tagsOnPage);
assertEquals("midnight on mars", blacklistedTag); assertEquals("midnight on mars", blacklistedTag);
} }
} }