From 125dab18d4412f547334f4fa2b27e5f7676eec5c Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 17 May 2019 11:10:30 +0200 Subject: [PATCH] =?utf8?q?=E2=9C=A8=20Annotate=20IndexPage=20with=20MenuNa?= =?utf8?q?me?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/net/pterodactylus/sone/web/pages/IndexPage.kt | 1 + src/test/kotlin/net/pterodactylus/sone/web/pages/IndexPageTest.kt | 5 +++++ src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest.kt | 2 ++ 3 files changed, 8 insertions(+) diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/IndexPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/IndexPage.kt index f44b145..68e7e8f 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/IndexPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/IndexPage.kt @@ -14,6 +14,7 @@ import javax.inject.Inject * The index page shows the main page of Sone. This page will contain the posts * of all friends of the current user. */ +@MenuName("Index") class IndexPage @Inject constructor(template: Template, webInterface: WebInterface, private val postVisibilityFilter: PostVisibilityFilter) : LoggedInPage("index.html", template, "Page.Index.Title", webInterface) { 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 39be2d6..07eb64a 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/IndexPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/IndexPageTest.kt @@ -159,4 +159,9 @@ class IndexPageTest: WebPageTest({ template, webInterface -> IndexPage(template, assertThat(baseInjector.getInstance(), notNullValue()) } + @Test + fun `page is annotated with correct menuname`() { + assertThat(page.menuName, equalTo("Index")) + } + } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest.kt index d48f5fd..5c842df 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest.kt @@ -54,6 +54,8 @@ open class WebPageTest(pageSupplier: (Template, WebInterface) -> SoneTemplatePag val sessionManager = mock() val page by lazy { pageSupplier(template, webInterface) } + val SoneTemplatePage.menuName get() = javaClass.getAnnotation(MenuName::class.java)?.value + val httpRequest = mock() val freenetRequest = mock() init { -- 2.7.4