From 2f5b8bf1c1a69221de059b50452684bfe3ab2a7e Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 24 Oct 2021 13:46:43 +0200 Subject: [PATCH] =?utf8?q?=F0=9F=8E=A8=20Replace=20test=20for=20Heldentage?= =?utf8?q?Filter=20with=20Kotlin=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../filters/comics/HeldentageFilterTest.java | 40 ---------------------- .../filters/comics/HeldentageFilterTest.kt | 30 ++++++++++++++++ 2 files changed, 30 insertions(+), 40 deletions(-) delete mode 100644 src/test/java/net/pterodactylus/rhynodge/filters/comics/HeldentageFilterTest.java create mode 100644 src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/HeldentageFilterTest.kt diff --git a/src/test/java/net/pterodactylus/rhynodge/filters/comics/HeldentageFilterTest.java b/src/test/java/net/pterodactylus/rhynodge/filters/comics/HeldentageFilterTest.java deleted file mode 100644 index 1779a63..0000000 --- a/src/test/java/net/pterodactylus/rhynodge/filters/comics/HeldentageFilterTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package net.pterodactylus.rhynodge.filters.comics; - -import java.io.IOException; - -import net.pterodactylus.rhynodge.filters.ResourceLoader; -import net.pterodactylus.rhynodge.states.ComicState; -import net.pterodactylus.rhynodge.states.HtmlState; - -import org.jsoup.nodes.Document; -import org.junit.Test; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.contains; - -/** - * Unit test for {@link HeldentageFilter}. - * - * @author David ‘Bombe’ Roden - */ -public class HeldentageFilterTest { - - private final HeldentageFilter heldentageFilter = new HeldentageFilter(); - private final HtmlState htmlState; - - public HeldentageFilterTest() throws IOException { - Document document = ResourceLoader.loadDocument(HeldentageFilter.class, "heldentage.html", "http://www.der-flix.de/"); - htmlState = new HtmlState("http://www.der-flix.de/", document); - } - - @Test - public void comicIsParsedCorrectly() { - ComicState comicState = (ComicState) heldentageFilter.filter(htmlState); - assertThat(comicState.comics(), contains( - ComicMatchers.isComic("", contains( - ComicMatchers.isStrip("http://www.der-flix.de/images/heldentage/Tag_916.jpg", "") - )) - )); - } - -} diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/HeldentageFilterTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/HeldentageFilterTest.kt new file mode 100644 index 0000000..4b041a0 --- /dev/null +++ b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/HeldentageFilterTest.kt @@ -0,0 +1,30 @@ +package net.pterodactylus.rhynodge.filters.comics + +import net.pterodactylus.rhynodge.filters.ResourceLoader +import net.pterodactylus.rhynodge.states.HtmlState +import net.pterodactylus.rhynodge.states.ComicState +import net.pterodactylus.rhynodge.states.ComicState.Comic +import net.pterodactylus.rhynodge.states.ComicState.Strip +import org.hamcrest.MatcherAssert.assertThat +import org.hamcrest.Matchers.contains +import org.junit.Test + +/** + * Unit test for [HeldentageFilter]. + */ +class HeldentageFilterTest { + + private val heldentageFilter = HeldentageFilter() + private val htmlState = ResourceLoader + .loadDocument(HeldentageFilter::class.java, "heldentage.html", "http://www.der-flix.de/") + .let { HtmlState("http://www.der-flix.de/", it) } + + @Test + fun comicIsParsedCorrectly() { + val comicState = heldentageFilter.filter(htmlState) as ComicState + assertThat(comicState.comics(), contains( + Comic("").add(Strip("http://www.der-flix.de/images/heldentage/Tag_916.jpg", "")) + )) + } + +} -- 2.7.4