From 2f1b2a7d5c7c722ec44c26253e59bde9e4f790c2 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:38:29 +0200 Subject: [PATCH] =?utf8?q?=E2=99=BB=EF=B8=8F=20Move=20Page.menuName=20prop?= =?utf8?q?erty=20to=20more=20appropriate=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/net/pterodactylus/sone/web/page/MenuName.kt | 4 ++++ src/main/kotlin/net/pterodactylus/sone/web/page/PageToadletFactory.kt | 2 -- src/test/kotlin/net/pterodactylus/sone/web/pages/IndexPageTest.kt | 1 + src/test/kotlin/net/pterodactylus/sone/web/pages/NewPageTest.kt | 1 + src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest.kt | 1 - 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/net/pterodactylus/sone/web/page/MenuName.kt b/src/main/kotlin/net/pterodactylus/sone/web/page/MenuName.kt index 6ee4ca6..d3d4bad 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/page/MenuName.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/page/MenuName.kt @@ -1,3 +1,7 @@ package net.pterodactylus.sone.web.page +import net.pterodactylus.util.web.* + annotation class MenuName(val value: String) + +val Page<*>.menuName get() = javaClass.getAnnotation(MenuName::class.java)?.value diff --git a/src/main/kotlin/net/pterodactylus/sone/web/page/PageToadletFactory.kt b/src/main/kotlin/net/pterodactylus/sone/web/page/PageToadletFactory.kt index c446432..3a01754 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/page/PageToadletFactory.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/page/PageToadletFactory.kt @@ -29,5 +29,3 @@ class PageToadletFactory @Inject constructor(private val highLevelSimpleClient: PageToadlet(highLevelSimpleClient, sessionManager, menuName ?: page.menuName, page, pathPrefix) } - -private val Page<*>.menuName get() = javaClass.getAnnotation(MenuName::class.java)?.value 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 07eb64a..2a72bb3 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/IndexPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/IndexPageTest.kt @@ -10,6 +10,7 @@ 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 net.pterodactylus.sone.web.page.* import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.contains import org.hamcrest.Matchers.emptyIterable diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/NewPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/NewPageTest.kt index 187b666..3a0f34c 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/NewPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/NewPageTest.kt @@ -8,6 +8,7 @@ import net.pterodactylus.sone.test.whenever import net.pterodactylus.sone.utils.Pagination import net.pterodactylus.sone.utils.asOptional import net.pterodactylus.sone.web.baseInjector +import net.pterodactylus.sone.web.page.* import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.contains import org.hamcrest.Matchers.containsInAnyOrder 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 5c842df..5d4f7a9 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest.kt @@ -54,7 +54,6 @@ 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() -- 2.7.4