X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FDeleteReplyPageTest.kt;h=d2c9844e995c3c39bf39a6ce4d3c1a665c6bfc68;hp=eb2d184bd1abc683b51f6026b81815dc2fe339cd;hb=a76956e389fcfe6282ad4ca7156bbf76327bb0c0;hpb=6b29b49714912ff5e3e410d2484699cdf8041b90 diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteReplyPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteReplyPageTest.kt index eb2d184..d2c9844 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteReplyPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteReplyPageTest.kt @@ -1,31 +1,23 @@ package net.pterodactylus.sone.web.pages -import net.pterodactylus.sone.data.PostReply -import net.pterodactylus.sone.data.Sone -import net.pterodactylus.sone.test.mock -import net.pterodactylus.sone.test.whenever -import net.pterodactylus.sone.web.pages.WebPageTest -import net.pterodactylus.sone.web.pages.DeleteReplyPage -import net.pterodactylus.util.web.Method.POST -import org.hamcrest.MatcherAssert.assertThat -import org.hamcrest.Matchers.equalTo -import org.junit.Before -import org.junit.Test -import org.mockito.Mockito.never -import org.mockito.Mockito.verify +import net.pterodactylus.sone.data.* +import net.pterodactylus.sone.test.* +import net.pterodactylus.sone.web.* +import net.pterodactylus.sone.web.page.* +import net.pterodactylus.util.web.Method.* +import org.hamcrest.MatcherAssert.* +import org.hamcrest.Matchers.* +import org.junit.* +import org.mockito.Mockito.* /** * Unit test for [DeleteReplyPage]. */ -class DeleteReplyPageTest : WebPageTest() { - - private val page = DeleteReplyPage(template, webInterface) +class DeleteReplyPageTest: WebPageTest(::DeleteReplyPage) { private val sone = mock() private val reply = mock() - override fun getPage() = page - @Before fun setupReply() { whenever(sone.isLocal).thenReturn(true) @@ -101,4 +93,14 @@ class DeleteReplyPageTest : WebPageTest() { } } + @Test + fun `page can be created by dependency injection`() { + assertThat(baseInjector.getInstance(), notNullValue()) + } + + @Test + fun `page is annotated with correct template path`() { + assertThat(page.templatePath, equalTo("/templates/deleteReply.html")) + } + }