Use new redirect verification
[Sone.git] / src / test / kotlin / net / pterodactylus / sone / web / OptionsPageTest.kt
index c79b497..b47dc34 100644 (file)
@@ -6,7 +6,6 @@ import net.pterodactylus.sone.data.SoneOptions.LoadExternalContent.TRUSTED
 import net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired
 import net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired.WRITING
 import net.pterodactylus.sone.test.whenever
-import net.pterodactylus.sone.web.WebTestUtils.redirectsTo
 import net.pterodactylus.util.web.Method.GET
 import net.pterodactylus.util.web.Method.POST
 import org.hamcrest.MatcherAssert.assertThat
@@ -23,6 +22,8 @@ class OptionsPageTest : WebPageTest() {
 
        private val page = OptionsPage(template, webInterface)
 
+       override fun getPage() = page
+
        @Before
        fun setupPreferences() {
                core.preferences.insertionDelay = 1
@@ -94,10 +95,7 @@ class OptionsPageTest : WebPageTest() {
                addHttpRequestParameter("show-custom-avatars", "ALWAYS")
                addHttpRequestParameter("load-linked-images", "ALWAYS")
                addHttpRequestParameter(option, setValue.toString())
-               expectedException.expect(redirectsTo("options.html"))
-               try {
-                       page.handleRequest(freenetRequest, templateContext)
-               } finally {
+               verifyRedirect("options.html") {
                        assertThat(getter(), equalTo(expectedValue))
                }
        }
@@ -149,10 +147,7 @@ class OptionsPageTest : WebPageTest() {
                unsetCurrentSone()
                request("", POST)
                addHttpRequestParameter(name, setValue)
-               expectedException.expect(redirectsTo("options.html"))
-               try {
-                       page.handleRequest(freenetRequest, templateContext)
-               } finally {
+               verifyRedirect("options.html") {
                        assertThat(getter(), equalTo(expectedValue))
                }
        }