From 2e6be6f2fb6afede009dacc48b8e3318e30e5057 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 18 May 2019 00:06:02 +0200 Subject: [PATCH] =?utf8?q?=F0=9F=8E=A8=20Fix=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../kotlin/net/pterodactylus/sone/web/pages/AboutPage.kt | 2 +- .../net/pterodactylus/sone/web/pages/CreateAlbumPage.kt | 2 +- .../net/pterodactylus/sone/web/pages/CreatePostPage.kt | 2 +- .../net/pterodactylus/sone/web/pages/CreateReplyPage.kt | 2 +- .../net/pterodactylus/sone/web/pages/CreateSonePage.kt | 2 +- .../net/pterodactylus/sone/web/pages/DeleteAlbumPage.kt | 2 +- .../net/pterodactylus/sone/web/pages/DeleteImagePage.kt | 2 +- .../net/pterodactylus/sone/web/pages/DeletePostPage.kt | 2 +- .../sone/web/pages/DeleteProfileFieldPage.kt | 2 +- .../net/pterodactylus/sone/web/pages/DeleteReplyPage.kt | 2 +- .../net/pterodactylus/sone/web/pages/DeleteSonePage.kt | 2 +- .../sone/web/pages/DismissNotificationPage.kt | 2 +- .../net/pterodactylus/sone/web/pages/DistrustPage.kt | 2 +- .../net/pterodactylus/sone/web/pages/EditAlbumPage.kt | 2 +- .../net/pterodactylus/sone/web/pages/EditImagePage.kt | 2 +- .../net/pterodactylus/sone/web/pages/FollowSonePage.kt | 2 +- .../net/pterodactylus/sone/web/pages/GetImagePage.kt | 2 +- .../net/pterodactylus/sone/web/pages/ImageBrowserPage.kt | 8 ++++---- .../net/pterodactylus/sone/web/pages/KnownSonesPage.kt | 2 +- .../net/pterodactylus/sone/web/pages/LockSonePage.kt | 2 +- .../kotlin/net/pterodactylus/sone/web/pages/LoginPage.kt | 2 +- .../net/pterodactylus/sone/web/pages/LogoutPage.kt | 2 +- .../net/pterodactylus/sone/web/pages/MarkAsKnownPage.kt | 2 +- .../kotlin/net/pterodactylus/sone/web/pages/NewPage.kt | 2 +- .../net/pterodactylus/sone/web/pages/OptionsPage.kt | 2 +- .../net/pterodactylus/sone/web/pages/ReloadingPage.kt | 2 +- .../net/pterodactylus/sone/web/pages/RescuePage.kt | 2 +- .../net/pterodactylus/sone/web/pages/SearchPage.kt | 3 ++- .../net/pterodactylus/sone/web/pages/UnbookmarkPage.kt | 2 +- .../net/pterodactylus/sone/web/pages/UnlikePage.kt | 2 +- .../net/pterodactylus/sone/web/pages/UnlockSonePage.kt | 2 +- .../net/pterodactylus/sone/web/pages/UploadImagePage.kt | 15 ++++++++------- .../net/pterodactylus/sone/web/pages/ViewPostPage.kt | 2 +- .../net/pterodactylus/sone/web/pages/ViewSonePage.kt | 2 +- .../net/pterodactylus/sone/web/pages/AboutPageTest.kt | 4 ++-- .../pterodactylus/sone/web/pages/BookmarksPageTest.kt | 6 +++--- .../pterodactylus/sone/web/pages/CreateAlbumPageTest.kt | 2 +- .../pterodactylus/sone/web/pages/CreatePostPageTest.kt | 6 +++--- .../pterodactylus/sone/web/pages/CreateReplyPageTest.kt | 6 +++--- .../pterodactylus/sone/web/pages/CreateSonePageTest.kt | 4 ++-- .../pterodactylus/sone/web/pages/DeleteAlbumPageTest.kt | 4 ++-- .../pterodactylus/sone/web/pages/DeleteImagePageTest.kt | 6 +++--- .../pterodactylus/sone/web/pages/DeletePostPageTest.kt | 10 +++++----- .../sone/web/pages/DeleteProfileFieldPageTest.kt | 4 ++-- .../pterodactylus/sone/web/pages/DeleteReplyPageTest.kt | 8 ++++---- .../pterodactylus/sone/web/pages/DeleteSonePageTest.kt | 12 ++++++------ .../sone/web/pages/DismissNotificationPageTest.kt | 2 +- .../net/pterodactylus/sone/web/pages/DistrustPageTest.kt | 2 +- .../pterodactylus/sone/web/pages/EditAlbumPageTest.kt | 4 ++-- .../pterodactylus/sone/web/pages/EditImagePageTest.kt | 6 +++--- .../sone/web/pages/EditProfileFieldPageTest.kt | 10 +++++----- .../pterodactylus/sone/web/pages/EditProfilePageTest.kt | 14 +++++++------- .../pterodactylus/sone/web/pages/FollowSonePageTest.kt | 10 +++++----- .../net/pterodactylus/sone/web/pages/GetImagePageTest.kt | 2 +- .../pterodactylus/sone/web/pages/ImageBrowserPageTest.kt | 16 ++++++++-------- .../net/pterodactylus/sone/web/pages/IndexPageTest.kt | 12 ++++++------ .../pterodactylus/sone/web/pages/KnownSonesPageTest.kt | 8 ++++---- .../net/pterodactylus/sone/web/pages/LikePageTest.kt | 10 +++++----- .../net/pterodactylus/sone/web/pages/LockSonePageTest.kt | 8 ++++---- .../net/pterodactylus/sone/web/pages/LoginPageTest.kt | 12 ++++++------ .../net/pterodactylus/sone/web/pages/LogoutPageTest.kt | 6 +++--- .../pterodactylus/sone/web/pages/MarkAsKnownPageTest.kt | 4 ++-- .../net/pterodactylus/sone/web/pages/NewPageTest.kt | 8 ++++---- .../net/pterodactylus/sone/web/pages/OptionsPageTest.kt | 8 ++++---- .../pterodactylus/sone/web/pages/ReloadingPageTest.kt | 6 ++++-- .../net/pterodactylus/sone/web/pages/RescuePageTest.kt | 8 ++++---- .../net/pterodactylus/sone/web/pages/SearchPageTest.kt | 6 +++--- .../pterodactylus/sone/web/pages/SoneTemplatePageTest.kt | 10 +++++----- .../net/pterodactylus/sone/web/pages/TrustPageTest.kt | 10 +++++----- .../pterodactylus/sone/web/pages/UnbookmarkPageTest.kt | 4 ++-- .../pterodactylus/sone/web/pages/UnfollowSonePageTest.kt | 10 +++++----- .../net/pterodactylus/sone/web/pages/UnlikePageTest.kt | 10 +++++----- .../pterodactylus/sone/web/pages/UnlockSonePageTest.kt | 10 +++++----- .../net/pterodactylus/sone/web/pages/UntrustPageTest.kt | 10 +++++----- .../pterodactylus/sone/web/pages/UploadImagePageTest.kt | 12 ++++++------ .../net/pterodactylus/sone/web/pages/ViewPostPageTest.kt | 6 +++--- .../net/pterodactylus/sone/web/pages/ViewSonePageTest.kt | 6 +++--- .../net/pterodactylus/sone/web/pages/WebPageTest.kt | 13 ++++++++----- 78 files changed, 215 insertions(+), 208 deletions(-) diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/AboutPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/AboutPage.kt index ed09c83..467df56 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/AboutPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/AboutPage.kt @@ -14,7 +14,7 @@ import javax.inject.* class AboutPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer, private val pluginVersion: PluginVersion, private val pluginYear: PluginYear, - private val pluginHomepage: PluginHomepage): SoneTemplatePage("about.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.About.Title") { + private val pluginHomepage: PluginHomepage) : SoneTemplatePage("about.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.About.Title") { override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) { templateContext["version"] = pluginVersion.version diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateAlbumPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateAlbumPage.kt index 409fcea..0931f90 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateAlbumPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateAlbumPage.kt @@ -14,7 +14,7 @@ import javax.inject.* * Page that lets the user create a new album. */ @TemplatePath("/templates/createAlbum.html") -class CreateAlbumPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class CreateAlbumPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("createAlbum.html", "Page.CreateAlbum.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/CreatePostPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/CreatePostPage.kt index 6155327..73e9253 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/CreatePostPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/CreatePostPage.kt @@ -13,7 +13,7 @@ import javax.inject.* * This page lets the user create a new [Post]. */ @TemplatePath("/templates/createPost.html") -class CreatePostPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class CreatePostPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("createPost.html", "Page.CreatePost.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateReplyPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateReplyPage.kt index 92a015a..55df29d 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateReplyPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateReplyPage.kt @@ -13,7 +13,7 @@ import javax.inject.* * This page lets the user post a reply to a post. */ @TemplatePath("/templates/createReply.html") -class CreateReplyPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class CreateReplyPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("createReply.html", "Page.CreateReply.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateSonePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateSonePage.kt index 0a49e5a..ef0c304 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateSonePage.kt @@ -14,7 +14,7 @@ import javax.inject.* */ @MenuName("CreateSone") @TemplatePath("/templates/createSone.html") -class CreateSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class CreateSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("createSone.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.CreateSone.Title") { private val logger = Logger.getLogger(CreateSonePage::class.java.name) diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPage.kt index 2b0357a..c8c02c8 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPage.kt @@ -12,7 +12,7 @@ import javax.inject.* * Page that lets the user delete an {@link Album}. */ @TemplatePath("/templates/deleteAlbum.html") -class DeleteAlbumPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class DeleteAlbumPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("deleteAlbum.html", "Page.DeleteAlbum.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteImagePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteImagePage.kt index 10535f7..b682115 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteImagePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteImagePage.kt @@ -12,7 +12,7 @@ import javax.inject.* * Page that lets the user delete an {@link Image}. */ @TemplatePath("/templates/deleteImage.html") -class DeleteImagePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class DeleteImagePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("deleteImage.html", "Page.DeleteImage.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeletePostPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeletePostPage.kt index 44fb32c..877a1fc 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeletePostPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeletePostPage.kt @@ -12,7 +12,7 @@ import javax.inject.* * Lets the user delete a post they made. */ @TemplatePath("/templates/deletePost.html") -class DeletePostPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class DeletePostPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("deletePost.html", "Page.DeletePost.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPage.kt index 9654620..b7bab53 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPage.kt @@ -12,7 +12,7 @@ import javax.inject.* * Page that lets the user confirm the deletion of a profile field. */ @TemplatePath("/templates/deleteProfileField.html") -class DeleteProfileFieldPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class DeleteProfileFieldPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("deleteProfileField.html", "Page.DeleteProfileField.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteReplyPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteReplyPage.kt index 3332a1d..77f7bee 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteReplyPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteReplyPage.kt @@ -12,7 +12,7 @@ import javax.inject.* * This page lets the user delete a reply. */ @TemplatePath("/templates/deleteReply.html") -class DeleteReplyPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class DeleteReplyPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("deleteReply.html", "Page.DeleteReply.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteSonePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteSonePage.kt index e19b9e4..6cb7b44 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteSonePage.kt @@ -15,7 +15,7 @@ import javax.inject.* */ @MenuName("DeleteSone") @TemplatePath("/templates/deleteSone.html") -class DeleteSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class DeleteSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("deleteSone.html", "Page.DeleteSone.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/DismissNotificationPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/DismissNotificationPage.kt index a6d83b7..7e6b599 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DismissNotificationPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DismissNotificationPage.kt @@ -9,7 +9,7 @@ import javax.inject.* /** * Page that lets the user dismiss a notification. */ -class DismissNotificationPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class DismissNotificationPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("dismissNotification.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.DismissNotification.Title") { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/DistrustPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/DistrustPage.kt index f4d8367..6a4fa8f 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DistrustPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DistrustPage.kt @@ -14,7 +14,7 @@ import javax.inject.* * * @see net.pterodactylus.sone.core.Core#distrustSone(Sone, Sone) */ -class DistrustPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class DistrustPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("distrust.html", "Page.Distrust.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/EditAlbumPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/EditAlbumPage.kt index 6762332..cf2be52 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/EditAlbumPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/EditAlbumPage.kt @@ -12,7 +12,7 @@ import javax.inject.* /** * Page that lets the user edit the name and description of an album. */ -class EditAlbumPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class EditAlbumPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("editAlbum.html", "Page.EditAlbum.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/EditImagePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/EditImagePage.kt index 9ca2a19..055d580 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/EditImagePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/EditImagePage.kt @@ -13,7 +13,7 @@ import javax.inject.* /** * Page that lets the user edit title and description of an {@link Image}. */ -class EditImagePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class EditImagePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("editImage.html", "Page.EditImage.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/FollowSonePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/FollowSonePage.kt index 10be225..2375278 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/FollowSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/FollowSonePage.kt @@ -11,7 +11,7 @@ import javax.inject.* /** * This page lets the user follow another Sone. */ -class FollowSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class FollowSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("followSone.html", "Page.FollowSone.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/GetImagePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/GetImagePage.kt index f939456..f7857c3 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/GetImagePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/GetImagePage.kt @@ -9,7 +9,7 @@ import javax.inject.* /** * Page that delivers a {@link TemporaryImage} to the browser. */ -class GetImagePage @Inject constructor(webInterface: WebInterface): FreenetPage { +class GetImagePage @Inject constructor(webInterface: WebInterface) : FreenetPage { private val core = webInterface.core diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/ImageBrowserPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/ImageBrowserPage.kt index 9e06c4a..cd81d1f 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/ImageBrowserPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/ImageBrowserPage.kt @@ -14,7 +14,7 @@ import javax.inject.* */ @MenuName("ImageBrowser") @TemplatePath("/templates/imageBrowser.html") -class ImageBrowserPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class ImageBrowserPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("imageBrowser.html", "Page.ImageBrowser.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { @@ -37,9 +37,9 @@ class ImageBrowserPage @Inject constructor(webInterface: WebInterface, loaders: albums.paginate(soneRequest.core.preferences.imagesPerPage) .turnTo(soneRequest.parameters["page"]?.toIntOrNull() ?: 0) .also { pagination -> - templateContext["albumPagination"] = pagination - templateContext["albums"] = pagination.items - } + templateContext["albumPagination"] = pagination + templateContext["albums"] = pagination.items + } } } else { templateContext["soneRequested"] = true diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPage.kt index 75e40cb..4c801e0 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPage.kt @@ -13,7 +13,7 @@ import javax.inject.* */ @MenuName("KnownSones") @TemplatePath("/templates/knownSones.html") -class KnownSonesPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class KnownSonesPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("knownSones.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.KnownSones.Title") { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/LockSonePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/LockSonePage.kt index 003cd2e..d846cec 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/LockSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/LockSonePage.kt @@ -10,7 +10,7 @@ import javax.inject.* /** * This page lets the user lock a [net.pterodactylus.sone.data.Sone] to prevent it from being inserted. */ -class LockSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class LockSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("lockSone.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.LockSone.Title") { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/LoginPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/LoginPage.kt index 1c3a02c..637ea9f 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/LoginPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/LoginPage.kt @@ -13,7 +13,7 @@ import javax.inject.* */ @MenuName("Login") @TemplatePath("/templates/login.html") -class LoginPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class LoginPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("login.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.Login.Title") { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/LogoutPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/LogoutPage.kt index 898d2c8..d9913ec 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/LogoutPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/LogoutPage.kt @@ -11,7 +11,7 @@ import javax.inject.* * Logs a user out. */ @MenuName("Logout") -class LogoutPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class LogoutPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("logout.html", "Page.Logout.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPage.kt index 8b67c03..4b53fb9 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPage.kt @@ -12,7 +12,7 @@ import javax.inject.* * Page that lets the user mark a number of [net.pterodactylus.sone.data.Sone]s, [Post]s, or * [Replie][net.pterodactylus.sone.data.Reply]s as known. */ -class MarkAsKnownPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class MarkAsKnownPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("markAsKnown.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.MarkAsKnown.Title") { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/NewPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/NewPage.kt index f572742..42fd921 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/NewPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/NewPage.kt @@ -13,7 +13,7 @@ import javax.inject.* */ @MenuName("New") @TemplatePath("/templates/new.html") -class NewPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class NewPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("new.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.New.Title") { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) = diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/OptionsPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/OptionsPage.kt index 31f2d89..782e5bb 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/OptionsPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/OptionsPage.kt @@ -14,7 +14,7 @@ import javax.inject.* */ @MenuName("Options") @TemplatePath("/templates/options.html") -class OptionsPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class OptionsPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("options.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.Options.Title") { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/ReloadingPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/ReloadingPage.kt index b6264f5..71a7a9b 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/ReloadingPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/ReloadingPage.kt @@ -7,7 +7,7 @@ import javax.inject.* /** * [Page] implementation that delivers static files from the filesystem. */ -class ReloadingPage @Inject constructor(private val prefix: String, private val path: String, private val mimeType: String): Page { +class ReloadingPage @Inject constructor(private val prefix: String, private val path: String, private val mimeType: String) : Page { override fun isPrefixPage() = true diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/RescuePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/RescuePage.kt index dd1c86d..af69a12 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/RescuePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/RescuePage.kt @@ -13,7 +13,7 @@ import javax.inject.* */ @MenuName("Rescue") @TemplatePath("/templates/rescue.html") -class RescuePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class RescuePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("rescue.html", "Page.Rescue.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/SearchPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/SearchPage.kt index fa344a8..4e29246 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/SearchPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/SearchPage.kt @@ -22,7 +22,8 @@ import javax.inject.* class SearchPage(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer, ticker: Ticker = Ticker.systemTicker()) : SoneTemplatePage("search.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.Search.Title") { - @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : + @Inject + constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : this(webInterface, loaders, templateRenderer, Ticker.systemTicker()) private val cache: Cache, Pagination> = CacheBuilder.newBuilder().ticker(ticker).expireAfterAccess(5, MINUTES).build() diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPage.kt index 29409b7..01d5f59 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPage.kt @@ -11,7 +11,7 @@ import javax.inject.* /** * Page that lets the user unbookmark a post. */ -class UnbookmarkPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class UnbookmarkPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("unbookmark.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.Unbookmark.Title") { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlikePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlikePage.kt index 85d7646..80c475e 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlikePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlikePage.kt @@ -11,7 +11,7 @@ import javax.inject.* /** * Page that lets the user unlike a [net.pterodactylus.sone.data.Post] or [net.pterodactylus.sone.data.Reply]. */ -class UnlikePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class UnlikePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("unlike.html", "Page.Unlike.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePage.kt index bb9487b..6ff2e7f 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePage.kt @@ -10,7 +10,7 @@ import javax.inject.* /** * This page lets the user unlock a [net.pterodactylus.sone.data.Sone] to allow its insertion. */ -class UnlockSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class UnlockSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("unlockSone.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.UnlockSone.Title") { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/UploadImagePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/UploadImagePage.kt index 55604ca..47454e6 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/UploadImagePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/UploadImagePage.kt @@ -17,7 +17,7 @@ import javax.inject.* * Page implementation that lets the user upload an image. */ @TemplatePath("/templates/invalid.html") -class UploadImagePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class UploadImagePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("uploadImage.html", "Page.UploadImage.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { @@ -56,13 +56,14 @@ class UploadImagePage @Inject constructor(webInterface: WebInterface, loaders: L ImageIO.read(it) } - private val ByteArray.mimeType get() = ByteArrayInputStream(this).use { - ImageIO.createImageInputStream(it).use { - ImageIO.getImageReaders(it).asSequence() - .firstOrNull()?.originatingProvider?.mimeTypes?.firstOrNull() - ?: UNKNOWN_MIME_TYPE + private val ByteArray.mimeType + get() = ByteArrayInputStream(this).use { + ImageIO.createImageInputStream(it).use { + ImageIO.getImageReaders(it).asSequence() + .firstOrNull()?.originatingProvider?.mimeTypes?.firstOrNull() + ?: UNKNOWN_MIME_TYPE + } } - } } diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/ViewPostPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/ViewPostPage.kt index b35d146..7d67ecd 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/ViewPostPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/ViewPostPage.kt @@ -13,7 +13,7 @@ import javax.inject.* * This page lets the user view a post and all its replies. */ @TemplatePath("/templates/viewPost.html") -class ViewPostPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class ViewPostPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("viewPost.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.ViewPost.Title") { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/ViewSonePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/ViewSonePage.kt index a49a798..189b3eb 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/ViewSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/ViewSonePage.kt @@ -14,7 +14,7 @@ import javax.inject.* * Lets the user browser another Sone. */ @TemplatePath("/templates/viewSone.html") -class ViewSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): +class ViewSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("viewSone.html", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { 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 a01abec..c3f0f76 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/AboutPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/AboutPageTest.kt @@ -59,12 +59,12 @@ class AboutPageTest : WebPageTest({ webInterface, loaders, templateRenderer -> A @Test fun `page is annotated with correct menuname`() { - assertThat(page.menuName, equalTo("About")) + assertThat(page.menuName, equalTo("About")) } @Test fun `page is annotated with correct template path`() { - assertThat(page.templatePath, equalTo("/templates/about.html")) + assertThat(page.templatePath, equalTo("/templates/about.html")) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/BookmarksPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/BookmarksPageTest.kt index 136db9e..3668755 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/BookmarksPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/BookmarksPageTest.kt @@ -12,7 +12,7 @@ import org.junit.* /** * Unit test for [BookmarksPage]. */ -class BookmarksPageTest: WebPageTest(::BookmarksPage) { +class BookmarksPageTest : WebPageTest(::BookmarksPage) { private val post1 = createLoadedPost(1000) private val post2 = createLoadedPost(3000) @@ -62,12 +62,12 @@ class BookmarksPageTest: WebPageTest(::BookmarksPage) { @Test fun `page is annotated with correct menuname`() { - assertThat(page.menuName, equalTo("Bookmarks")) + assertThat(page.menuName, equalTo("Bookmarks")) } @Test fun `page is annotated with correct template path`() { - assertThat(page.templatePath, equalTo("/templates/bookmarks.html")) + assertThat(page.templatePath, equalTo("/templates/bookmarks.html")) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/CreateAlbumPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/CreateAlbumPageTest.kt index 7e348e9..224791f 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/CreateAlbumPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/CreateAlbumPageTest.kt @@ -102,7 +102,7 @@ class CreateAlbumPageTest : WebPageTest(::CreateAlbumPage) { @Test fun `page is annotated with correct template path`() { - assertThat(page.templatePath, equalTo("/templates/createAlbum.html")) + assertThat(page.templatePath, equalTo("/templates/createAlbum.html")) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/CreatePostPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/CreatePostPageTest.kt index 4dab09e..2bf0c05 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/CreatePostPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/CreatePostPageTest.kt @@ -15,7 +15,7 @@ import org.mockito.Mockito.* /** * Unit test for [CreatePostPage]. */ -class CreatePostPageTest: WebPageTest(::CreatePostPage) { +class CreatePostPageTest : WebPageTest(::CreatePostPage) { @Test fun `page returns correct path`() { @@ -92,12 +92,12 @@ class CreatePostPageTest: WebPageTest(::CreatePostPage) { @Test fun `page can be created by dependency injection`() { - assertThat(baseInjector.getInstance(), notNullValue()) + assertThat(baseInjector.getInstance(), notNullValue()) } @Test fun `page is annotated with correct template path`() { - assertThat(page.templatePath, equalTo("/templates/createPost.html")) + assertThat(page.templatePath, equalTo("/templates/createPost.html")) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/CreateReplyPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/CreateReplyPageTest.kt index 5edd766..062a010 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/CreateReplyPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/CreateReplyPageTest.kt @@ -13,7 +13,7 @@ import org.mockito.Mockito.* /** * Unit test for [CreateReplyPage]. */ -class CreateReplyPageTest: WebPageTest(::CreateReplyPage) { +class CreateReplyPageTest : WebPageTest(::CreateReplyPage) { @Test fun `page returns correct path`() { @@ -88,12 +88,12 @@ class CreateReplyPageTest: WebPageTest(::CreateReplyPage) { @Test fun `page can be created by dependency injection`() { - assertThat(baseInjector.getInstance(), notNullValue()) + assertThat(baseInjector.getInstance(), notNullValue()) } @Test fun `page is annotated with correct template path`() { - assertThat(page.templatePath, equalTo("/templates/createReply.html")) + assertThat(page.templatePath, equalTo("/templates/createReply.html")) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/CreateSonePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/CreateSonePageTest.kt index 1871944..6a4a2b0 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/CreateSonePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/CreateSonePageTest.kt @@ -148,12 +148,12 @@ class CreateSonePageTest : WebPageTest(::CreateSonePage) { @Test fun `page is annotated with the correct menuname`() { - assertThat(page.menuName, equalTo("CreateSone")) + assertThat(page.menuName, equalTo("CreateSone")) } @Test fun `page is annotated with the correct template path`() { - assertThat(page.templatePath, equalTo("/templates/createSone.html")) + assertThat(page.templatePath, equalTo("/templates/createSone.html")) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPageTest.kt index ccf2123..55b3d70 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPageTest.kt @@ -14,7 +14,7 @@ import org.mockito.Mockito.verify /** * Unit test for [DeleteAlbumPage]. */ -class DeleteAlbumPageTest: WebPageTest(::DeleteAlbumPage) { +class DeleteAlbumPageTest : WebPageTest(::DeleteAlbumPage) { private val sone = mock() private val album = mock() @@ -110,7 +110,7 @@ class DeleteAlbumPageTest: WebPageTest(::DeleteAlbumPage) { @Test fun `page is annotated with correct template path`() { - assertThat(page.templatePath, equalTo("/templates/deleteAlbum.html")) + assertThat(page.templatePath, equalTo("/templates/deleteAlbum.html")) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteImagePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteImagePageTest.kt index 1c5c274..cecde50 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteImagePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteImagePageTest.kt @@ -13,7 +13,7 @@ import org.mockito.Mockito.* /** * Unit test for [DeleteImagePage]. */ -class DeleteImagePageTest: WebPageTest(::DeleteImagePage) { +class DeleteImagePageTest : WebPageTest(::DeleteImagePage) { private val image = mock() private val sone = mock() @@ -80,12 +80,12 @@ class DeleteImagePageTest: WebPageTest(::DeleteImagePage) { @Test fun `page can be created by dependency injection`() { - assertThat(baseInjector.getInstance(), notNullValue()) + assertThat(baseInjector.getInstance(), notNullValue()) } @Test fun `page is annotated with correct template path`() { - assertThat(page.templatePath, equalTo("/templates/deleteImage.html")) + assertThat(page.templatePath, equalTo("/templates/deleteImage.html")) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/DeletePostPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/DeletePostPageTest.kt index 8466001..9464920 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/DeletePostPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/DeletePostPageTest.kt @@ -13,7 +13,7 @@ import org.mockito.Mockito.* /** * Unit test for [DeletePostPage]. */ -class DeletePostPageTest: WebPageTest(::DeletePostPage) { +class DeletePostPageTest : WebPageTest(::DeletePostPage) { private val post = mock() private val sone = mock() @@ -26,12 +26,12 @@ class DeletePostPageTest: WebPageTest(::DeletePostPage) { @Test fun `page returns correct path`() { - assertThat(page.path, equalTo("deletePost.html")) + assertThat(page.path, equalTo("deletePost.html")) } @Test fun `page requires login`() { - assertThat(page.requiresLogin(), equalTo(true)) + assertThat(page.requiresLogin(), equalTo(true)) } @Test @@ -102,12 +102,12 @@ class DeletePostPageTest: WebPageTest(::DeletePostPage) { @Test fun `page can be created by dependency injection`() { - assertThat(baseInjector.getInstance(), notNullValue()) + assertThat(baseInjector.getInstance(), notNullValue()) } @Test fun `page is annotated with correct template path`() { - assertThat(page.templatePath, equalTo("/templates/deletePost.html")) + assertThat(page.templatePath, equalTo("/templates/deletePost.html")) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPageTest.kt index 7bbd56c..728966c 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPageTest.kt @@ -13,7 +13,7 @@ import org.mockito.Mockito.* /** * Unit test for [DeleteProfileFieldPage]. */ -class DeleteProfileFieldPageTest: WebPageTest(::DeleteProfileFieldPage) { +class DeleteProfileFieldPageTest : WebPageTest(::DeleteProfileFieldPage) { private val profile = Profile(currentSone) private val field = profile.addField("name") @@ -80,7 +80,7 @@ class DeleteProfileFieldPageTest: WebPageTest(::DeleteProfileFieldPage) { @Test fun `page is annotated with correct template path`() { - assertThat(page.templatePath, equalTo("/templates/deleteProfileField.html")) + assertThat(page.templatePath, equalTo("/templates/deleteProfileField.html")) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteReplyPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteReplyPageTest.kt index d2c9844..f9a07c2 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteReplyPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteReplyPageTest.kt @@ -13,7 +13,7 @@ import org.mockito.Mockito.* /** * Unit test for [DeleteReplyPage]. */ -class DeleteReplyPageTest: WebPageTest(::DeleteReplyPage) { +class DeleteReplyPageTest : WebPageTest(::DeleteReplyPage) { private val sone = mock() private val reply = mock() @@ -26,12 +26,12 @@ class DeleteReplyPageTest: WebPageTest(::DeleteReplyPage) { @Test fun `page returns correct path`() { - assertThat(page.path, equalTo("deleteReply.html")) + assertThat(page.path, equalTo("deleteReply.html")) } @Test fun `page requires login`() { - assertThat(page.requiresLogin(), equalTo(true)) + assertThat(page.requiresLogin(), equalTo(true)) } @Test @@ -100,7 +100,7 @@ class DeleteReplyPageTest: WebPageTest(::DeleteReplyPage) { @Test fun `page is annotated with correct template path`() { - assertThat(page.templatePath, equalTo("/templates/deleteReply.html")) + assertThat(page.templatePath, equalTo("/templates/deleteReply.html")) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteSonePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteSonePageTest.kt index 350bdf9..21cfdfc 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteSonePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteSonePageTest.kt @@ -12,21 +12,21 @@ import org.mockito.Mockito.* /** * Unit test for [DeleteSonePage]. */ -class DeleteSonePageTest: WebPageTest(::DeleteSonePage) { +class DeleteSonePageTest : WebPageTest(::DeleteSonePage) { @Test fun `page returns correct path`() { - assertThat(page.path, equalTo("deleteSone.html")) + assertThat(page.path, equalTo("deleteSone.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.DeleteSone.Title")).thenReturn("delete sone page") + whenever(l10n.getString("Page.DeleteSone.Title")).thenReturn("delete sone page") assertThat(page.getPageTitle(soneRequest), equalTo("delete sone page")) } @@ -59,12 +59,12 @@ class DeleteSonePageTest: WebPageTest(::DeleteSonePage) { @Test fun `page is annotated with correct menuname`() { - assertThat(page.menuName, equalTo("DeleteSone")) + assertThat(page.menuName, equalTo("DeleteSone")) } @Test fun `page is annotated with correct template path`() { - assertThat(page.templatePath, equalTo("/templates/deleteSone.html")) + assertThat(page.templatePath, equalTo("/templates/deleteSone.html")) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/DismissNotificationPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/DismissNotificationPageTest.kt index cc29939..e8583df 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/DismissNotificationPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/DismissNotificationPageTest.kt @@ -12,7 +12,7 @@ import org.mockito.Mockito.* /** * Unit test for [DismissNotificationPage]. */ -class DismissNotificationPageTest: WebPageTest(::DismissNotificationPage) { +class DismissNotificationPageTest : WebPageTest(::DismissNotificationPage) { private val notification = mock() diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/DistrustPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/DistrustPageTest.kt index f8250d7..d706e05 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/DistrustPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/DistrustPageTest.kt @@ -12,7 +12,7 @@ import org.mockito.Mockito.* /** * Unit test for [DistrustPage]. */ -class DistrustPageTest: WebPageTest(::DistrustPage) { +class DistrustPageTest : WebPageTest(::DistrustPage) { @Test fun `page returns correct path`() { diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/EditAlbumPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/EditAlbumPageTest.kt index 6226a30..4d435b4 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/EditAlbumPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/EditAlbumPageTest.kt @@ -14,7 +14,7 @@ import org.mockito.Mockito.* /** * Unit test for [EditAlbumPage]. */ -class EditAlbumPageTest: WebPageTest(::EditAlbumPage) { +class EditAlbumPageTest : WebPageTest(::EditAlbumPage) { private val album = mock() private val parentAlbum = mock() @@ -119,7 +119,7 @@ class EditAlbumPageTest: WebPageTest(::EditAlbumPage) { @Test fun `page can be created by dependency injection`() { - assertThat(baseInjector.getInstance(), notNullValue()) + assertThat(baseInjector.getInstance(), notNullValue()) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/EditImagePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/EditImagePageTest.kt index 7e26e9a..0961622 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/EditImagePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/EditImagePageTest.kt @@ -14,7 +14,7 @@ import org.mockito.Mockito.* /** * Unit test for [EditImagePage]. */ -class EditImagePageTest: WebPageTest(::EditImagePage) { +class EditImagePageTest : WebPageTest(::EditImagePage) { private val image = mock() private val modifier = mockBuilder() @@ -38,13 +38,13 @@ class EditImagePageTest: WebPageTest(::EditImagePage) { @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.EditImage.Title")).thenReturn("edit image page title") - assertThat(page.getPageTitle(soneRequest), equalTo("edit image page title")) + assertThat(page.getPageTitle(soneRequest), equalTo("edit image page title")) } @Test diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/EditProfileFieldPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/EditProfileFieldPageTest.kt index 6f61384..7731fa2 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/EditProfileFieldPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/EditProfileFieldPageTest.kt @@ -13,7 +13,7 @@ import org.mockito.Mockito.* /** * Unit test for [EditProfileFieldPage]. */ -class EditProfileFieldPageTest: WebPageTest(::EditProfileFieldPage) { +class EditProfileFieldPageTest : WebPageTest(::EditProfileFieldPage) { private val profile = Profile(currentSone) private val field = profile.addField("Name") @@ -25,18 +25,18 @@ class EditProfileFieldPageTest: WebPageTest(::EditProfileFieldPage) { @Test fun `page returns correct path`() { - assertThat(page.path, equalTo("editProfileField.html")) + assertThat(page.path, equalTo("editProfileField.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.EditProfileField.Title")).thenReturn("edit profile field title") - assertThat(page.getPageTitle(soneRequest), equalTo("edit profile field title")) + assertThat(page.getPageTitle(soneRequest), equalTo("edit profile field title")) } @Test @@ -100,7 +100,7 @@ class EditProfileFieldPageTest: WebPageTest(::EditProfileFieldPage) { @Test fun `page is annotated with correct template path`() { - assertThat(page.templatePath, equalTo("/templates/editProfileField.html")) + assertThat(page.templatePath, equalTo("/templates/editProfileField.html")) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/EditProfilePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/EditProfilePageTest.kt index dce4ee5..a31f04c 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/EditProfilePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/EditProfilePageTest.kt @@ -13,7 +13,7 @@ import org.mockito.Mockito.* /** * Unit test for [EditProfilePage]. */ -class EditProfilePageTest: WebPageTest(::EditProfilePage) { +class EditProfilePageTest : WebPageTest(::EditProfilePage) { private val profile = Profile(currentSone) private val firstField = profile.addField("First Field") @@ -36,17 +36,17 @@ class EditProfilePageTest: WebPageTest(::EditProfilePage) { @Test fun `page returns correct path`() { - assertThat(page.path, equalTo("editProfile.html")) + assertThat(page.path, equalTo("editProfile.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.EditProfile.Title")).thenReturn("edit profile page title") + whenever(l10n.getString("Page.EditProfile.Title")).thenReturn("edit profile page title") assertThat(page.getPageTitle(soneRequest), equalTo("edit profile page title")) } @@ -216,17 +216,17 @@ class EditProfilePageTest: WebPageTest(::EditProfilePage) { @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("EditProfile")) + assertThat(page.menuName, equalTo("EditProfile")) } @Test fun `page is annotated with correct template path`() { - assertThat(page.templatePath, equalTo("/templates/editProfile.html")) + assertThat(page.templatePath, equalTo("/templates/editProfile.html")) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/FollowSonePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/FollowSonePageTest.kt index 81af00e..ba1dc42 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/FollowSonePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/FollowSonePageTest.kt @@ -16,21 +16,21 @@ import org.mockito.Mockito.verify /** * Unit test for [FollowSonePage]. */ -class FollowSonePageTest: WebPageTest(::FollowSonePage) { +class FollowSonePageTest : WebPageTest(::FollowSonePage) { @Test fun `page returns correct path`() { - assertThat(page.path, equalTo("followSone.html")) + assertThat(page.path, equalTo("followSone.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.FollowSone.Title")).thenReturn("follow sone page title") + whenever(l10n.getString("Page.FollowSone.Title")).thenReturn("follow sone page title") assertThat(page.getPageTitle(soneRequest), equalTo("follow sone page title")) } @@ -82,7 +82,7 @@ class FollowSonePageTest: WebPageTest(::FollowSonePage) { @Test fun `page can be created by dependency injection`() { - assertThat(baseInjector.getInstance(), notNullValue()) + assertThat(baseInjector.getInstance(), notNullValue()) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/GetImagePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/GetImagePageTest.kt index 1298771..f4428bd 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/GetImagePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/GetImagePageTest.kt @@ -63,7 +63,7 @@ class GetImagePageTest { @Test fun `page can be created by dependency injection`() { - assertThat(baseInjector.getInstance(), notNullValue()) + assertThat(baseInjector.getInstance(), notNullValue()) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/ImageBrowserPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/ImageBrowserPageTest.kt index d99f569..a0e9372 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/ImageBrowserPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/ImageBrowserPageTest.kt @@ -12,22 +12,22 @@ import java.net.* /** * Unit test for [ImageBrowserPage]. */ -class ImageBrowserPageTest: WebPageTest(::ImageBrowserPage) { +class ImageBrowserPageTest : WebPageTest(::ImageBrowserPage) { @Test fun `page returns correct path`() { - assertThat(page.path, equalTo("imageBrowser.html")) + assertThat(page.path, equalTo("imageBrowser.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.ImageBrowser.Title")).thenReturn("image browser page title") - assertThat(page.getPageTitle(soneRequest), equalTo("image browser page title")) + assertThat(page.getPageTitle(soneRequest), equalTo("image browser page title")) } @Test @@ -129,22 +129,22 @@ class ImageBrowserPageTest: WebPageTest(::ImageBrowserPage) { @Test fun `page is link-excepted`() { - assertThat(page.isLinkExcepted(URI("")), equalTo(true)) + assertThat(page.isLinkExcepted(URI("")), equalTo(true)) } @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("ImageBrowser")) + assertThat(page.menuName, equalTo("ImageBrowser")) } @Test fun `page is annotated with correct template path`() { - assertThat(page.templatePath, equalTo("/templates/imageBrowser.html")) + assertThat(page.templatePath, equalTo("/templates/imageBrowser.html")) } } 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 ba0f216..9104127 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/IndexPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/IndexPageTest.kt @@ -16,7 +16,7 @@ import org.mockito.* /** * Unit test for [IndexPage]. */ -class IndexPageTest: WebPageTest({ webInterface, loaders, templateRenderer -> IndexPage(webInterface, loaders, templateRenderer, postVisibilityFilter) }) { +class IndexPageTest : WebPageTest({ webInterface, loaders, templateRenderer -> IndexPage(webInterface, loaders, templateRenderer, postVisibilityFilter) }) { companion object { private val postVisibilityFilter = mock() @@ -24,18 +24,18 @@ class IndexPageTest: WebPageTest({ webInterface, loaders, templateRenderer -> In @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(soneRequest), equalTo("index page title")) + assertThat(page.getPageTitle(soneRequest), equalTo("index page title")) } @Before @@ -150,12 +150,12 @@ class IndexPageTest: WebPageTest({ webInterface, loaders, templateRenderer -> In @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")) + assertThat(page.menuName, equalTo("Index")) } @Test diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPageTest.kt index a816d23..37e0e95 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPageTest.kt @@ -13,7 +13,7 @@ import org.junit.* /** * Unit test for [KnownSonesPage]. */ -class KnownSonesPageTest: WebPageTest(::KnownSonesPage) { +class KnownSonesPageTest : WebPageTest(::KnownSonesPage) { private val sones = listOf( createSone(1000, 4, 7, 2, "sone2", true, true), @@ -237,17 +237,17 @@ class KnownSonesPageTest: WebPageTest(::KnownSonesPage) { @Test fun `page can be created by dependency injection`() { - assertThat(baseInjector.getInstance(), notNullValue()) + assertThat(baseInjector.getInstance(), notNullValue()) } @Test fun `page is annotated with the correct menuname`() { - assertThat(page.menuName, equalTo("KnownSones")) + assertThat(page.menuName, equalTo("KnownSones")) } @Test fun `page is annotated with corrrect template path`() { - assertThat(page.templatePath, equalTo("/templates/knownSones.html")) + assertThat(page.templatePath, equalTo("/templates/knownSones.html")) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/LikePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/LikePageTest.kt index c8d7a3b..4140644 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/LikePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/LikePageTest.kt @@ -11,21 +11,21 @@ import org.mockito.Mockito.* /** * Unit test for [LikePage]. */ -class LikePageTest: WebPageTest(::LikePage) { +class LikePageTest : WebPageTest(::LikePage) { @Test fun `page returns correct path`() { - assertThat(page.path, equalTo("like.html")) + assertThat(page.path, equalTo("like.html")) } @Test fun `page requires login`() { - assertThat(page.requiresLogin(), equalTo(true)) + assertThat(page.requiresLogin(), equalTo(true)) } @Test fun `page returns correct title`() { - addTranslation("Page.Like.Title", "like page title") + addTranslation("Page.Like.Title", "like page title") assertThat(page.getPageTitle(soneRequest), equalTo("like page title")) } @@ -68,7 +68,7 @@ class LikePageTest: WebPageTest(::LikePage) { @Test fun `page can be created by dependency injection`() { - assertThat(baseInjector.getInstance(), notNullValue()) + assertThat(baseInjector.getInstance(), notNullValue()) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/LockSonePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/LockSonePageTest.kt index 2b80dbb..de42141 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/LockSonePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/LockSonePageTest.kt @@ -14,7 +14,7 @@ import org.mockito.Mockito.verify /** * Unit test for [LockSonePage]. */ -class LockSonePageTest: WebPageTest(::LockSonePage) { +class LockSonePageTest : WebPageTest(::LockSonePage) { @Test fun `page returns correct path`() { @@ -23,12 +23,12 @@ class LockSonePageTest: WebPageTest(::LockSonePage) { @Test fun `page does not require login`() { - assertThat(page.requiresLogin(), equalTo(false)) + assertThat(page.requiresLogin(), equalTo(false)) } @Test fun `page returns correct title`() { - addTranslation("Page.LockSone.Title", "lock Sone page title") + addTranslation("Page.LockSone.Title", "lock Sone page title") assertThat(page.getPageTitle(soneRequest), equalTo("lock Sone page title")) } @@ -55,7 +55,7 @@ class LockSonePageTest: WebPageTest(::LockSonePage) { @Test fun `page can be created by dependency injection`() { - assertThat(baseInjector.getInstance(), notNullValue()) + assertThat(baseInjector.getInstance(), notNullValue()) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/LoginPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/LoginPageTest.kt index ea51d8b..067857e 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/LoginPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/LoginPageTest.kt @@ -14,7 +14,7 @@ import org.mockito.Mockito.* /** * Unit test for [LoginPage]. */ -class LoginPageTest: WebPageTest(::LoginPage) { +class LoginPageTest : WebPageTest(::LoginPage) { private val sones = listOf(createSone("Sone", "Test"), createSone("Test"), createSone("Sone")) @@ -40,12 +40,12 @@ class LoginPageTest: WebPageTest(::LoginPage) { @Test fun `page returns correct path`() { - assertThat(page.path, equalTo("login.html")) + assertThat(page.path, equalTo("login.html")) } @Test fun `page does not require login`() { - assertThat(page.requiresLogin(), equalTo(false)) + assertThat(page.requiresLogin(), equalTo(false)) } @Test @@ -135,17 +135,17 @@ class LoginPageTest: WebPageTest(::LoginPage) { @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("Login")) + assertThat(page.menuName, equalTo("Login")) } @Test fun `page is annotated with correct template path`() { - assertThat(page.templatePath, equalTo("/templates/login.html")) + assertThat(page.templatePath, equalTo("/templates/login.html")) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/LogoutPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/LogoutPageTest.kt index ae7de0d..fae95d2 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/LogoutPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/LogoutPageTest.kt @@ -11,7 +11,7 @@ import org.mockito.Mockito.* /** * Unit test for [LogoutPage]. */ -class LogoutPageTest: WebPageTest(::LogoutPage) { +class LogoutPageTest : WebPageTest(::LogoutPage) { @Test fun `page returns correct path`() { @@ -70,12 +70,12 @@ class LogoutPageTest: WebPageTest(::LogoutPage) { @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("Logout")) + assertThat(page.menuName, equalTo("Logout")) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPageTest.kt index 0bb49e0..6142e3a 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPageTest.kt @@ -12,7 +12,7 @@ import org.mockito.Mockito.* /** * Unit test for [MarkAsKnownPage]. */ -class MarkAsKnownPageTest: WebPageTest(::MarkAsKnownPage) { +class MarkAsKnownPageTest : WebPageTest(::MarkAsKnownPage) { @Test fun `page returns correct path`() { @@ -84,7 +84,7 @@ class MarkAsKnownPageTest: WebPageTest(::MarkAsKnownPage) { @Test fun `page can be created by dependency injection`() { - assertThat(baseInjector.getInstance(), notNullValue()) + assertThat(baseInjector.getInstance(), notNullValue()) } } 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 ecdb3db..a4d7617 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/NewPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/NewPageTest.kt @@ -13,7 +13,7 @@ import java.util.Arrays.* /** * Unit test for [NewPage]. */ -class NewPageTest: WebPageTest(::NewPage) { +class NewPageTest : WebPageTest(::NewPage) { @Before fun setupNumberOfPostsPerPage() { @@ -79,17 +79,17 @@ class NewPageTest: WebPageTest(::NewPage) { @Test fun `page can be created by dependency injection`() { - assertThat(baseInjector.getInstance(), notNullValue()) + assertThat(baseInjector.getInstance(), notNullValue()) } @Test fun `page is annotated with the correct menuname`() { - assertThat(page.menuName, equalTo("New")) + assertThat(page.menuName, equalTo("New")) } @Test fun `page is annotated with correct template path`() { - assertThat(page.templatePath, equalTo("/templates/new.html")) + assertThat(page.templatePath, equalTo("/templates/new.html")) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/OptionsPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/OptionsPageTest.kt index 853b4fb..71e1b7b 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/OptionsPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/OptionsPageTest.kt @@ -15,7 +15,7 @@ import org.junit.* /** * Unit test for [OptionsPage]. */ -class OptionsPageTest: WebPageTest(::OptionsPage) { +class OptionsPageTest : WebPageTest(::OptionsPage) { @Before fun setupPreferences() { @@ -375,17 +375,17 @@ class OptionsPageTest: WebPageTest(::OptionsPage) { @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("Options")) + assertThat(page.menuName, equalTo("Options")) } @Test fun `page is annotated with correct template path`() { - assertThat(page.templatePath, equalTo("/templates/options.html")) + assertThat(page.templatePath, equalTo("/templates/options.html")) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/ReloadingPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/ReloadingPageTest.kt index e32dc1b..99cf8bf 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/ReloadingPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/ReloadingPageTest.kt @@ -15,7 +15,9 @@ import kotlin.text.Charsets.UTF_8 */ class ReloadingPageTest { - @Rule @JvmField val tempFolder = TemporaryFolder() + @Rule + @JvmField + val tempFolder = TemporaryFolder() private val folder by lazy { tempFolder.newFolder()!! } private val page by lazy { ReloadingPage("/prefix/", folder.path, "text/plain") } private val webPageTest = WebPageTest() @@ -54,7 +56,7 @@ class ReloadingPageTest { @Test fun `page can be created by dependency injection`() { - assertThat(baseInjector.getInstance>(), notNullValue()) + assertThat(baseInjector.getInstance>(), notNullValue()) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/RescuePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/RescuePageTest.kt index dabcbbe..d11352f 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/RescuePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/RescuePageTest.kt @@ -15,7 +15,7 @@ import org.mockito.Mockito.verify /** * Unit test for [RescuePage]. */ -class RescuePageTest: WebPageTest(::RescuePage) { +class RescuePageTest : WebPageTest(::RescuePage) { private val soneRescuer = mock() @@ -87,17 +87,17 @@ class RescuePageTest: WebPageTest(::RescuePage) { @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("Rescue")) + assertThat(page.menuName, equalTo("Rescue")) } @Test fun `page is annotated with correct template path`() { - assertThat(page.templatePath, equalTo("/templates/rescue.html")) + assertThat(page.templatePath, equalTo("/templates/rescue.html")) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/SearchPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/SearchPageTest.kt index cc01a15..329f458 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/SearchPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/SearchPageTest.kt @@ -16,7 +16,7 @@ import java.util.concurrent.atomic.* /** * Unit test for [SearchPage]. */ -class SearchPageTest: WebPageTest({ webInterface, loaders, templateRenderer -> SearchPage(webInterface, loaders, templateRenderer, ticker) }) { +class SearchPageTest : WebPageTest({ webInterface, loaders, templateRenderer -> SearchPage(webInterface, loaders, templateRenderer, ticker) }) { companion object { val ticker = mock() @@ -360,12 +360,12 @@ class SearchPageTest: WebPageTest({ webInterface, loaders, templateRenderer -> S @Test fun `page can be created by dependency injection`() { - assertThat(baseInjector.getInstance(), notNullValue()) + assertThat(baseInjector.getInstance(), notNullValue()) } @Test fun `page is annotated with correct template path`() { - assertThat(page.templatePath, equalTo("/templates/search.html")) + assertThat(page.templatePath, equalTo("/templates/search.html")) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePageTest.kt index 1bfb6ff..ffb8997 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePageTest.kt @@ -214,11 +214,11 @@ class SoneTemplatePageTest : WebPageTest({ webInterface, loaders, templateRender @Test fun `handle request with sone request is called`() { var called = false - val page = object : SoneTemplatePage("path.html", webInterface, loaders, templateRenderer) { - override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { - called = true - } - } + val page = object : SoneTemplatePage("path.html", webInterface, loaders, templateRenderer) { + override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { + called = true + } + } page.processTemplate(freenetRequest, templateContext) assertThat(called, equalTo(true)) } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/TrustPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/TrustPageTest.kt index 851762b..990c1b7 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/TrustPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/TrustPageTest.kt @@ -16,21 +16,21 @@ import org.mockito.Mockito.verify /** * Unit test for [TrustPage]. */ -class TrustPageTest: WebPageTest(::TrustPage) { +class TrustPageTest : WebPageTest(::TrustPage) { @Test fun `page returns correct path`() { - assertThat(page.path, equalTo("trust.html")) + assertThat(page.path, equalTo("trust.html")) } @Test fun `page requires login`() { - assertThat(page.requiresLogin(), equalTo(true)) + assertThat(page.requiresLogin(), equalTo(true)) } @Test fun `page returns correct title`() { - addTranslation("Page.Trust.Title", "title trust page") + addTranslation("Page.Trust.Title", "title trust page") assertThat(page.getPageTitle(soneRequest), equalTo("title trust page")) } @@ -72,7 +72,7 @@ class TrustPageTest: WebPageTest(::TrustPage) { @Test fun `page can be created by dependency injection`() { - assertThat(baseInjector.getInstance(), notNullValue()) + assertThat(baseInjector.getInstance(), notNullValue()) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPageTest.kt index 0180187..4025fe4 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPageTest.kt @@ -12,7 +12,7 @@ import org.mockito.Mockito.* /** * Unit test for [UnbookmarkPage]. */ -class UnbookmarkPageTest: WebPageTest(::UnbookmarkPage) { +class UnbookmarkPageTest : WebPageTest(::UnbookmarkPage) { @Test fun `page returns correct path`() { @@ -74,7 +74,7 @@ class UnbookmarkPageTest: WebPageTest(::UnbookmarkPage) { @Test fun `page can be created by dependency injection`() { - assertThat(baseInjector.getInstance(), notNullValue()) + assertThat(baseInjector.getInstance(), notNullValue()) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/UnfollowSonePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/UnfollowSonePageTest.kt index 63b902b..39f4fd5 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/UnfollowSonePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/UnfollowSonePageTest.kt @@ -11,21 +11,21 @@ import org.mockito.Mockito.* /** * Unit test for [UnfollowSonePage]. */ -class UnfollowSonePageTest: WebPageTest(::UnfollowSonePage) { +class UnfollowSonePageTest : WebPageTest(::UnfollowSonePage) { @Test fun `page returns correct path`() { - assertThat(page.path, equalTo("unfollowSone.html")) + assertThat(page.path, equalTo("unfollowSone.html")) } @Test fun `page requires login`() { - assertThat(page.requiresLogin(), equalTo(true)) + assertThat(page.requiresLogin(), equalTo(true)) } @Test fun `page returns correct page title`() { - addTranslation("Page.UnfollowSone.Title", "unfollow page title") + addTranslation("Page.UnfollowSone.Title", "unfollow page title") assertThat(page.getPageTitle(soneRequest), equalTo("unfollow page title")) } @@ -57,7 +57,7 @@ class UnfollowSonePageTest: WebPageTest(::UnfollowSonePage) { @Test fun `page can be created by dependency injection`() { - assertThat(baseInjector.getInstance(), notNullValue()) + assertThat(baseInjector.getInstance(), notNullValue()) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/UnlikePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/UnlikePageTest.kt index fa30cb0..2d8ef89 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/UnlikePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/UnlikePageTest.kt @@ -13,22 +13,22 @@ import org.mockito.Mockito.verify /** * Unit test for [UnlikePage]. */ -class UnlikePageTest: WebPageTest(::UnlikePage) { +class UnlikePageTest : WebPageTest(::UnlikePage) { @Test fun `page returns correct path`() { - assertThat(page.path, equalTo("unlike.html")) + assertThat(page.path, equalTo("unlike.html")) } @Test fun `page requires login`() { - assertThat(page.requiresLogin(), equalTo(true)) + assertThat(page.requiresLogin(), equalTo(true)) } @Test fun `page returns correct title`() { addTranslation("Page.Unlike.Title", "unlike page title") - assertThat(page.getPageTitle(soneRequest), equalTo("unlike page title")) + assertThat(page.getPageTitle(soneRequest), equalTo("unlike page title")) } @Test @@ -72,7 +72,7 @@ class UnlikePageTest: WebPageTest(::UnlikePage) { @Test fun `page can be created by dependency injection`() { - assertThat(baseInjector.getInstance(), notNullValue()) + assertThat(baseInjector.getInstance(), notNullValue()) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePageTest.kt index 7f839fa..8627fd4 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePageTest.kt @@ -14,22 +14,22 @@ import org.mockito.Mockito.verify /** * Unit test for [UnlockSonePage]. */ -class UnlockSonePageTest: WebPageTest(::UnlockSonePage) { +class UnlockSonePageTest : WebPageTest(::UnlockSonePage) { @Test fun `page returns correct path`() { - assertThat(page.path, equalTo("unlockSone.html")) + assertThat(page.path, equalTo("unlockSone.html")) } @Test fun `page does not require login`() { - assertThat(page.requiresLogin(), equalTo(false)) + assertThat(page.requiresLogin(), equalTo(false)) } @Test fun `page returns correct title`() { addTranslation("Page.UnlockSone.Title", "unlock page title") - assertThat(page.getPageTitle(soneRequest), equalTo("unlock page title")) + assertThat(page.getPageTitle(soneRequest), equalTo("unlock page title")) } @Test @@ -76,7 +76,7 @@ class UnlockSonePageTest: WebPageTest(::UnlockSonePage) { @Test fun `page can be created by dependency injection`() { - assertThat(baseInjector.getInstance(), notNullValue()) + assertThat(baseInjector.getInstance(), notNullValue()) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/UntrustPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/UntrustPageTest.kt index cd11259..eb0ebdd 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/UntrustPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/UntrustPageTest.kt @@ -16,22 +16,22 @@ import org.mockito.Mockito.verify /** * Unit test for [UntrustPage]. */ -class UntrustPageTest: WebPageTest(::UntrustPage) { +class UntrustPageTest : WebPageTest(::UntrustPage) { @Test fun `page returns correct path`() { - assertThat(page.path, equalTo("untrust.html")) + assertThat(page.path, equalTo("untrust.html")) } @Test fun `page requires login`() { - assertThat(page.requiresLogin(), equalTo(true)) + assertThat(page.requiresLogin(), equalTo(true)) } @Test fun `page returns correct title`() { addTranslation("Page.Untrust.Title", "untrust page title") - assertThat(page.getPageTitle(soneRequest), equalTo("untrust page title")) + assertThat(page.getPageTitle(soneRequest), equalTo("untrust page title")) } @Test @@ -74,7 +74,7 @@ class UntrustPageTest: WebPageTest(::UntrustPage) { @Test fun `page can be created by dependency injection`() { - assertThat(baseInjector.getInstance(), notNullValue()) + assertThat(baseInjector.getInstance(), notNullValue()) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/UploadImagePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/UploadImagePageTest.kt index 13df43d..370c0a7 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/UploadImagePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/UploadImagePageTest.kt @@ -18,7 +18,7 @@ import org.mockito.Mockito.eq /** * Unit test for [UploadImagePage]. */ -class UploadImagePageTest: WebPageTest(::UploadImagePage) { +class UploadImagePageTest : WebPageTest(::UploadImagePage) { private val parentAlbum = mock().apply { whenever(id).thenReturn("parent-id") @@ -27,17 +27,17 @@ class UploadImagePageTest: WebPageTest(::UploadImagePage) { @Test fun `page returns correct path`() { - assertThat(page.path, equalTo("uploadImage.html")) + assertThat(page.path, equalTo("uploadImage.html")) } @Test fun `page requires login`() { - assertThat(page.requiresLogin(), equalTo(true)) + assertThat(page.requiresLogin(), equalTo(true)) } @Test fun `page returns correct title`() { - addTranslation("Page.UploadImage.Title", "upload image page title") + addTranslation("Page.UploadImage.Title", "upload image page title") assertThat(page.getPageTitle(soneRequest), equalTo("upload image page title")) } @@ -115,12 +115,12 @@ class UploadImagePageTest: WebPageTest(::UploadImagePage) { @Test fun `page can be created by dependency injection`() { - assertThat(baseInjector.getInstance(), notNullValue()) + assertThat(baseInjector.getInstance(), notNullValue()) } @Test fun `page is annotated with correct template path`() { - assertThat(page.templatePath, equalTo("/templates/invalid.html")) + assertThat(page.templatePath, equalTo("/templates/invalid.html")) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/ViewPostPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/ViewPostPageTest.kt index aac42d6..6ba1550 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/ViewPostPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/ViewPostPageTest.kt @@ -12,7 +12,7 @@ import java.net.* /** * Unit test for [ViewPostPage]. */ -class ViewPostPageTest: WebPageTest(::ViewPostPage) { +class ViewPostPageTest : WebPageTest(::ViewPostPage) { private val post = mock() @@ -99,12 +99,12 @@ class ViewPostPageTest: WebPageTest(::ViewPostPage) { @Test fun `page can be created by dependency injection`() { - assertThat(baseInjector.getInstance(), notNullValue()) + assertThat(baseInjector.getInstance(), notNullValue()) } @Test fun `page is annotated with correct template path`() { - assertThat(page.templatePath, equalTo("/templates/viewPost.html")) + assertThat(page.templatePath, equalTo("/templates/viewPost.html")) } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/ViewSonePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/ViewSonePageTest.kt index f40bb25..6e97e36 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/ViewSonePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/ViewSonePageTest.kt @@ -13,7 +13,7 @@ import java.net.* /** * Unit test for [ViewSonePage]. */ -class ViewSonePageTest: WebPageTest(::ViewSonePage) { +class ViewSonePageTest : WebPageTest(::ViewSonePage) { init { whenever(currentSone.id).thenReturn("sone-id") @@ -200,12 +200,12 @@ class ViewSonePageTest: WebPageTest(::ViewSonePage) { @Test fun `page can be created by dependency injection`() { - assertThat(baseInjector.getInstance(), notNullValue()) + assertThat(baseInjector.getInstance(), notNullValue()) } @Test fun `page is annotated with correct template path`() { - assertThat(page.templatePath, equalTo("/templates/viewSone.html")) + assertThat(page.templatePath, equalTo("/templates/viewSone.html")) } } 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 fc63959..f51bece 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest.kt @@ -47,11 +47,13 @@ open class WebPageTest(pageSupplier: (WebInterface, Loaders, TemplateRenderer) - val httpRequest = mock() val freenetRequest = mock() + init { whenever(freenetRequest.l10n).thenReturn(l10n) whenever(freenetRequest.sessionManager).thenReturn(sessionManager) whenever(freenetRequest.uri).thenReturn(mock()) } + val soneRequest by lazy { freenetRequest.toSoneRequest(core, webInterface) } val templateContext = TemplateContext() val toadletContext = deepMock() @@ -94,8 +96,8 @@ open class WebPageTest(pageSupplier: (WebInterface, Loaders, TemplateRenderer) - whenever(core.getPostReply(anyString())).then { allPostReplies[it[0]] } whenever(core.getReplies(anyString())).then { perPostReplies[it[0]].asList() } whenever(core.getAlbum(anyString())).then { allAlbums[it[0]] } - whenever(core.getImage(anyString())).then { allImages[it[0]]} - whenever(core.getImage(anyString(), anyBoolean())).then { allImages[it[0]]} + whenever(core.getImage(anyString())).then { allImages[it[0]] } + whenever(core.getImage(anyString(), anyBoolean())).then { allImages[it[0]] } whenever(core.getTemporaryImage(anyString())).thenReturn(null) } @@ -125,12 +127,13 @@ open class WebPageTest(pageSupplier: (WebInterface, Loaders, TemplateRenderer) - whenever(httpRequest.getPartAsStringFailsafe(anyString(), anyInt())).then { postRequestParameters[it[0]]?.decode()?.take(it[1]) ?: "" } whenever(httpRequest.getUploadedFile(anyString())).then { it.get(0).takeIf { it in uploadedFileNames } - ?.let { name -> UploadedFile(uploadedFileNames[name]!!, uploadedFileContentTypes[name]!!, uploadedFileResources[name]!!) - } + ?.let { name -> + UploadedFile(uploadedFileNames[name]!!, uploadedFileContentTypes[name]!!, uploadedFileResources[name]!!) + } } } - private class UploadedFile(private val filename: String, private val contentType: String, private val resourceName: String): HTTPUploadedFile { + private class UploadedFile(private val filename: String, private val contentType: String, private val resourceName: String) : HTTPUploadedFile { override fun getFilename() = filename override fun getContentType() = contentType override fun getData() = javaClass.getResourceAsStream(resourceName).readBytes().let(::SimpleReadOnlyArrayBucket) -- 2.7.4