From: David ‘Bombe’ Roden Date: Fri, 17 May 2019 09:38:29 +0000 (+0200) Subject: ♻️ Move Page.menuName property to more appropriate file X-Git-Tag: v79^2~44 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=2f1b2a7d5c7c722ec44c26253e59bde9e4f790c2;p=Sone.git ♻️ Move Page.menuName property to more appropriate file --- 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()