Simplify verifying that no redirect is called
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 23 May 2017 18:07:52 +0000 (20:07 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 23 May 2017 18:07:52 +0000 (20:07 +0200)
src/test/java/net/pterodactylus/sone/web/pages/WebPageTest.java
src/test/kotlin/net/pterodactylus/sone/web/pages/LikePageTest.kt

index bd21b19..c785e36 100644 (file)
@@ -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);
        }
index 4539269..588717e 100644 (file)
@@ -36,7 +36,7 @@ class LikePageTest : WebPageTest() {
        @Test
        fun `get request does not redirect`() {
                request("", GET)
-               page.handleRequest(freenetRequest, templateContext)
+               verifyNoRedirect {}
        }
 
        @Test