From: David ‘Bombe’ Roden Date: Tue, 23 May 2017 18:07:52 +0000 (+0200) Subject: Simplify verifying that no redirect is called X-Git-Tag: 0.9.7^2~214 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=adfa1ad91aece5798cb1ffbffc1b0792a62ca4e0;p=Sone.git Simplify verifying that no redirect is called --- diff --git a/src/test/java/net/pterodactylus/sone/web/pages/WebPageTest.java b/src/test/java/net/pterodactylus/sone/web/pages/WebPageTest.java index bd21b19..c785e36 100644 --- a/src/test/java/net/pterodactylus/sone/web/pages/WebPageTest.java +++ b/src/test/java/net/pterodactylus/sone/web/pages/WebPageTest.java @@ -407,6 +407,11 @@ public abstract class WebPageTest { } } + protected void verifyNoRedirect(Runnable verification) throws RedirectException { + getPage().handleRequest(freenetRequest, templateContext); + verification.run(); + } + protected void addTranslation(@Nonnull String key, @Nonnull String value) { when(l10n.getString(key)).thenReturn(value); } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/LikePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/LikePageTest.kt index 4539269..588717e 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/LikePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/LikePageTest.kt @@ -36,7 +36,7 @@ class LikePageTest : WebPageTest() { @Test fun `get request does not redirect`() { request("", GET) - page.handleRequest(freenetRequest, templateContext) + verifyNoRedirect {} } @Test