From adfa1ad91aece5798cb1ffbffc1b0792a62ca4e0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 23 May 2017 20:07:52 +0200 Subject: [PATCH] Simplify verifying that no redirect is called --- src/test/java/net/pterodactylus/sone/web/pages/WebPageTest.java | 5 +++++ src/test/kotlin/net/pterodactylus/sone/web/pages/LikePageTest.kt | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) 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 -- 2.7.4