X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FDeleteProfileFieldPageTest.kt;h=678991d02008a16266f4b5768c98725a63978b25;hp=56bdfe185c46a0665a9b7b7a211b5b5b5717eaaa;hb=110a933c2724aba6a604fc5eed6372ff1e1e6144;hpb=6b29b49714912ff5e3e410d2484699cdf8041b90 diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPageTest.kt index 56bdfe1..678991d 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPageTest.kt @@ -1,12 +1,14 @@ package net.pterodactylus.sone.web.pages import net.pterodactylus.sone.data.Profile +import net.pterodactylus.sone.test.getInstance import net.pterodactylus.sone.test.whenever -import net.pterodactylus.sone.web.pages.WebPageTest -import net.pterodactylus.sone.web.pages.DeleteProfileFieldPage +import net.pterodactylus.sone.web.baseInjector +import net.pterodactylus.sone.web.page.* import net.pterodactylus.util.web.Method.POST import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.equalTo +import org.hamcrest.Matchers.notNullValue import org.hamcrest.Matchers.nullValue import org.junit.Before import org.junit.Test @@ -17,15 +19,11 @@ import org.mockito.Mockito.verify /** * Unit test for [DeleteProfileFieldPage]. */ -class DeleteProfileFieldPageTest: WebPageTest() { - - private val page = DeleteProfileFieldPage(template, webInterface) +class DeleteProfileFieldPageTest: WebPageTest(::DeleteProfileFieldPage) { private val profile = Profile(currentSone) private val field = profile.addField("name") - override fun getPage() = page - @Before fun setupProfile() { whenever(currentSone.profile).thenReturn(profile) @@ -81,4 +79,14 @@ class DeleteProfileFieldPageTest: 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/deleteProfileField.html")) + } + }