X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FAboutPageTest.kt;h=5201704c7b05cf0ace1c926bca1beda83874d6c2;hp=4d5d80a2e5d0a9cecff4f3575ca50189f1e80ad0;hb=110a933c2724aba6a604fc5eed6372ff1e1e6144;hpb=9bdfd50edb7c8b07bdc0ad1d4a4555ad63e4ea6d diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/AboutPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/AboutPageTest.kt index 4d5d80a..5201704 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/AboutPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/AboutPageTest.kt @@ -1,13 +1,10 @@ package net.pterodactylus.sone.web.pages -import com.google.inject.Guice -import net.pterodactylus.sone.main.SonePlugin.PluginHomepage -import net.pterodactylus.sone.main.SonePlugin.PluginVersion -import net.pterodactylus.sone.main.SonePlugin.PluginYear +import net.pterodactylus.sone.main.* import net.pterodactylus.sone.test.getInstance import net.pterodactylus.sone.test.isProvidedByMock -import net.pterodactylus.sone.web.WebInterface -import net.pterodactylus.util.template.Template +import net.pterodactylus.sone.web.baseInjector +import net.pterodactylus.sone.web.page.* import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.equalTo import org.hamcrest.Matchers.notNullValue @@ -16,7 +13,7 @@ import org.junit.Test /** * Unit test for [AboutPage]. */ -class AboutPageTest : WebPageTest({ template, webInterface -> AboutPage(template, webInterface, PluginVersion(version), PluginYear(year), PluginHomepage(homepage)) }) { +class AboutPageTest : WebPageTest({ webInterface, loaders, templateRenderer -> AboutPage(webInterface, loaders, templateRenderer, PluginVersion(version), PluginYear(year), PluginHomepage(homepage)) }) { companion object { private const val version = "0.1.2" @@ -54,9 +51,7 @@ class AboutPageTest : WebPageTest({ template, webInterface -> AboutPage(template @Test fun `about page can be created by dependency injection`() { - val injector = Guice.createInjector( - Template::class.isProvidedByMock(), - WebInterface::class.isProvidedByMock(), + val injector = baseInjector.createChildInjector( PluginVersion::class.isProvidedByMock(), PluginYear::class.isProvidedByMock(), PluginHomepage::class.isProvidedByMock() @@ -64,4 +59,14 @@ class AboutPageTest : WebPageTest({ template, webInterface -> AboutPage(template assertThat(injector.getInstance(), notNullValue()) } + @Test + fun `page is annotated with correct menuname`() { + assertThat(page.menuName, equalTo("About")) + } + + @Test + fun `page is annotated with correct template path`() { + assertThat(page.templatePath, equalTo("/templates/about.html")) + } + }