X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FIndexPageTest.kt;h=91041270d056c62d3763e2f842ff254dc0aaa22b;hb=03cec6a6772c2d836d94864adddaf544cbe9d72f;hp=1e200c1d31f53bf42b95a1f639ffa36f4b6db1c9;hpb=fc8e9ea5c978d2f5a00894e093364ae62f18934b;p=Sone.git diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/IndexPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/IndexPageTest.kt index 1e200c1..9104127 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/IndexPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/IndexPageTest.kt @@ -1,28 +1,22 @@ package net.pterodactylus.sone.web.pages -import com.google.common.base.Optional.fromNullable -import com.google.common.base.Predicate -import net.pterodactylus.sone.data.Post -import net.pterodactylus.sone.data.Sone -import net.pterodactylus.sone.notify.PostVisibilityFilter -import net.pterodactylus.sone.test.getInstance -import net.pterodactylus.sone.test.mock -import net.pterodactylus.sone.test.whenever -import net.pterodactylus.sone.utils.Pagination -import net.pterodactylus.sone.web.baseInjector -import org.hamcrest.MatcherAssert.assertThat -import org.hamcrest.Matchers.contains -import org.hamcrest.Matchers.emptyIterable -import org.hamcrest.Matchers.equalTo -import org.hamcrest.Matchers.notNullValue -import org.junit.Before -import org.junit.Test -import org.mockito.ArgumentMatchers +import com.google.common.base.* +import com.google.common.base.Optional.* +import net.pterodactylus.sone.data.* +import net.pterodactylus.sone.notify.* +import net.pterodactylus.sone.test.* +import net.pterodactylus.sone.utils.* +import net.pterodactylus.sone.web.* +import net.pterodactylus.sone.web.page.* +import org.hamcrest.MatcherAssert.* +import org.hamcrest.Matchers.* +import org.junit.* +import org.mockito.* /** * Unit test for [IndexPage]. */ -class IndexPageTest: WebPageTest({ template, webInterface -> IndexPage(template, webInterface, postVisibilityFilter) }) { +class IndexPageTest : WebPageTest({ webInterface, loaders, templateRenderer -> IndexPage(webInterface, loaders, templateRenderer, postVisibilityFilter) }) { companion object { private val postVisibilityFilter = mock() @@ -30,18 +24,18 @@ class IndexPageTest: WebPageTest({ template, webInterface -> IndexPage(template, @Test fun `page returns correct path`() { - assertThat(page.path, equalTo("index.html")) + assertThat(page.path, equalTo("index.html")) } @Test fun `page requires login`() { - assertThat(page.requiresLogin(), equalTo(true)) + assertThat(page.requiresLogin(), equalTo(true)) } @Test fun `page returns correct title`() { whenever(l10n.getString("Page.Index.Title")).thenReturn("index page title") - assertThat(page.getPageTitle(freenetRequest), equalTo("index page title")) + assertThat(page.getPageTitle(soneRequest), equalTo("index page title")) } @Before @@ -156,7 +150,17 @@ class IndexPageTest: WebPageTest({ template, webInterface -> IndexPage(template, @Test fun `page can be created by dependency injection`() { - assertThat(baseInjector.getInstance(), notNullValue()) + assertThat(baseInjector.getInstance(), notNullValue()) + } + + @Test + fun `page is annotated with correct menuname`() { + assertThat(page.menuName, equalTo("Index")) + } + + @Test + fun `page is annotated with correct template path`() { + assertThat(page.templatePath, equalTo("/templates/index.html")) } }