🎨 Fix formatting
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 17 May 2019 22:06:02 +0000 (00:06 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 17 May 2019 22:06:02 +0000 (00:06 +0200)
78 files changed:
src/main/kotlin/net/pterodactylus/sone/web/pages/AboutPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/CreateAlbumPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/CreatePostPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/CreateReplyPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/CreateSonePage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteImagePage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/DeletePostPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteReplyPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteSonePage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/DismissNotificationPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/DistrustPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/EditAlbumPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/EditImagePage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/FollowSonePage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/GetImagePage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/ImageBrowserPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/LockSonePage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/LoginPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/LogoutPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/NewPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/OptionsPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/ReloadingPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/RescuePage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/SearchPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/UnlikePage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/UploadImagePage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/ViewPostPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/ViewSonePage.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/AboutPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/BookmarksPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/CreateAlbumPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/CreatePostPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/CreateReplyPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/CreateSonePageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteImagePageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/DeletePostPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteReplyPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteSonePageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/DismissNotificationPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/DistrustPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/EditAlbumPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/EditImagePageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/EditProfileFieldPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/EditProfilePageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/FollowSonePageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/GetImagePageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/ImageBrowserPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/IndexPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/LikePageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/LockSonePageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/LoginPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/LogoutPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/NewPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/OptionsPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/ReloadingPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/RescuePageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/SearchPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/TrustPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/UnfollowSonePageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/UnlikePageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/UntrustPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/UploadImagePageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/ViewPostPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/ViewSonePageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest.kt

index ed09c83..467df56 100644 (file)
@@ -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
index 409fcea..0931f90 100644 (file)
@@ -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) {
index 6155327..73e9253 100644 (file)
@@ -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) {
index 92a015a..55df29d 100644 (file)
@@ -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) {
index 0a49e5a..ef0c304 100644 (file)
@@ -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)
index 2b0357a..c8c02c8 100644 (file)
@@ -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) {
index 10535f7..b682115 100644 (file)
@@ -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) {
index 44fb32c..877a1fc 100644 (file)
@@ -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) {
index 9654620..b7bab53 100644 (file)
@@ -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) {
index 3332a1d..77f7bee 100644 (file)
@@ -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) {
index e19b9e4..6cb7b44 100644 (file)
@@ -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) {
index a6d83b7..7e6b599 100644 (file)
@@ -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) {
index f4d8367..6a4fa8f 100644 (file)
@@ -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) {
index 6762332..cf2be52 100644 (file)
@@ -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) {
index 9ca2a19..055d580 100644 (file)
@@ -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) {
index 10be225..2375278 100644 (file)
@@ -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) {
index f939456..f7857c3 100644 (file)
@@ -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
 
index 9e06c4a..cd81d1f 100644 (file)
@@ -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
index 75e40cb..4c801e0 100644 (file)
@@ -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) {
index 003cd2e..d846cec 100644 (file)
@@ -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) {
index 1c3a02c..637ea9f 100644 (file)
@@ -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) {
index 898d2c8..d9913ec 100644 (file)
@@ -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) {
index 8b67c03..4b53fb9 100644 (file)
@@ -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) {
index f572742..42fd921 100644 (file)
@@ -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) =
index 31f2d89..782e5bb 100644 (file)
@@ -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) {
index b6264f5..71a7a9b 100644 (file)
@@ -7,7 +7,7 @@ import javax.inject.*
 /**
  * [Page] implementation that delivers static files from the filesystem.
  */
-class ReloadingPage<R: Request> @Inject constructor(private val prefix: String, private val path: String, private val mimeType: String): Page<R> {
+class ReloadingPage<R : Request> @Inject constructor(private val prefix: String, private val path: String, private val mimeType: String) : Page<R> {
 
        override fun isPrefixPage() = true
 
index dd1c86d..af69a12 100644 (file)
@@ -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) {
index fa344a8..4e29246 100644 (file)
@@ -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<Iterable<Phrase>, Pagination<Post>> = CacheBuilder.newBuilder().ticker(ticker).expireAfterAccess(5, MINUTES).build()
index 29409b7..01d5f59 100644 (file)
@@ -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) {
index 85d7646..80c475e 100644 (file)
@@ -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) {
index bb9487b..6ff2e7f 100644 (file)
@@ -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) {
index 55604ca..47454e6 100644 (file)
@@ -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
+                       }
                }
-       }
 
 }
 
index b35d146..7d67ecd 100644 (file)
@@ -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) {
index a49a798..189b3eb 100644 (file)
@@ -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) {
index a01abec..c3f0f76 100644 (file)
@@ -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"))
        }
 
 }
index 136db9e..3668755 100644 (file)
@@ -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"))
        }
 
 }
index 7e348e9..224791f 100644 (file)
@@ -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"))
        }
 
 }
index 4dab09e..2bf0c05 100644 (file)
@@ -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<CreatePostPage>(), notNullValue())
+               assertThat(baseInjector.getInstance<CreatePostPage>(), notNullValue())
        }
 
        @Test
        fun `page is annotated with correct template path`() {
-           assertThat(page.templatePath, equalTo("/templates/createPost.html"))
+               assertThat(page.templatePath, equalTo("/templates/createPost.html"))
        }
 
 }
index 5edd766..062a010 100644 (file)
@@ -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<CreateReplyPage>(), notNullValue())
+               assertThat(baseInjector.getInstance<CreateReplyPage>(), notNullValue())
        }
 
        @Test
        fun `page is annotated with correct template path`() {
-           assertThat(page.templatePath, equalTo("/templates/createReply.html"))
+               assertThat(page.templatePath, equalTo("/templates/createReply.html"))
        }
 
 }
index 1871944..6a4a2b0 100644 (file)
@@ -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"))
        }
 
 }
index ccf2123..55b3d70 100644 (file)
@@ -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<Sone>()
        private val album = mock<Album>()
@@ -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"))
        }
 
 }
index 1c5c274..cecde50 100644 (file)
@@ -13,7 +13,7 @@ import org.mockito.Mockito.*
 /**
  * Unit test for [DeleteImagePage].
  */
-class DeleteImagePageTest: WebPageTest(::DeleteImagePage) {
+class DeleteImagePageTest : WebPageTest(::DeleteImagePage) {
 
        private val image = mock<Image>()
        private val sone = mock<Sone>()
@@ -80,12 +80,12 @@ class DeleteImagePageTest: WebPageTest(::DeleteImagePage) {
 
        @Test
        fun `page can be created by dependency injection`() {
-           assertThat(baseInjector.getInstance<DeleteImagePage>(), notNullValue())
+               assertThat(baseInjector.getInstance<DeleteImagePage>(), notNullValue())
        }
 
        @Test
        fun `page is annotated with correct template path`() {
-           assertThat(page.templatePath, equalTo("/templates/deleteImage.html"))
+               assertThat(page.templatePath, equalTo("/templates/deleteImage.html"))
        }
 
 }
index 8466001..9464920 100644 (file)
@@ -13,7 +13,7 @@ import org.mockito.Mockito.*
 /**
  * Unit test for [DeletePostPage].
  */
-class DeletePostPageTest: WebPageTest(::DeletePostPage) {
+class DeletePostPageTest : WebPageTest(::DeletePostPage) {
 
        private val post = mock<Post>()
        private val sone = mock<Sone>()
@@ -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<DeletePostPage>(), notNullValue())
+               assertThat(baseInjector.getInstance<DeletePostPage>(), notNullValue())
        }
 
        @Test
        fun `page is annotated with correct template path`() {
-           assertThat(page.templatePath, equalTo("/templates/deletePost.html"))
+               assertThat(page.templatePath, equalTo("/templates/deletePost.html"))
        }
 
 }
index 7bbd56c..728966c 100644 (file)
@@ -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"))
        }
 
 }
index d2c9844..f9a07c2 100644 (file)
@@ -13,7 +13,7 @@ import org.mockito.Mockito.*
 /**
  * Unit test for [DeleteReplyPage].
  */
-class DeleteReplyPageTest: WebPageTest(::DeleteReplyPage) {
+class DeleteReplyPageTest : WebPageTest(::DeleteReplyPage) {
 
        private val sone = mock<Sone>()
        private val reply = mock<PostReply>()
@@ -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"))
        }
 
 }
index 350bdf9..21cfdfc 100644 (file)
@@ -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"))
        }
 
 }
index cc29939..e8583df 100644 (file)
@@ -12,7 +12,7 @@ import org.mockito.Mockito.*
 /**
  * Unit test for [DismissNotificationPage].
  */
-class DismissNotificationPageTest: WebPageTest(::DismissNotificationPage) {
+class DismissNotificationPageTest : WebPageTest(::DismissNotificationPage) {
 
        private val notification = mock<Notification>()
 
index f8250d7..d706e05 100644 (file)
@@ -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`() {
index 6226a30..4d435b4 100644 (file)
@@ -14,7 +14,7 @@ import org.mockito.Mockito.*
 /**
  * Unit test for [EditAlbumPage].
  */
-class EditAlbumPageTest: WebPageTest(::EditAlbumPage) {
+class EditAlbumPageTest : WebPageTest(::EditAlbumPage) {
 
        private val album = mock<Album>()
        private val parentAlbum = mock<Album>()
@@ -119,7 +119,7 @@ class EditAlbumPageTest: WebPageTest(::EditAlbumPage) {
 
        @Test
        fun `page can be created by dependency injection`() {
-           assertThat(baseInjector.getInstance<EditAlbumPage>(), notNullValue())
+               assertThat(baseInjector.getInstance<EditAlbumPage>(), notNullValue())
        }
 
 }
index 7e26e9a..0961622 100644 (file)
@@ -14,7 +14,7 @@ import org.mockito.Mockito.*
 /**
  * Unit test for [EditImagePage].
  */
-class EditImagePageTest: WebPageTest(::EditImagePage) {
+class EditImagePageTest : WebPageTest(::EditImagePage) {
 
        private val image = mock<Image>()
        private val modifier = mockBuilder<Modifier>()
@@ -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
index 6f61384..7731fa2 100644 (file)
@@ -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"))
        }
 
 }
index dce4ee5..a31f04c 100644 (file)
@@ -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<EditProfilePage>(), notNullValue())
+               assertThat(baseInjector.getInstance<EditProfilePage>(), 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"))
        }
 
 }
index 81af00e..ba1dc42 100644 (file)
@@ -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<FollowSonePage>(), notNullValue())
+               assertThat(baseInjector.getInstance<FollowSonePage>(), notNullValue())
        }
 
 }
index 1298771..f4428bd 100644 (file)
@@ -63,7 +63,7 @@ class GetImagePageTest {
 
        @Test
        fun `page can be created by dependency injection`() {
-           assertThat(baseInjector.getInstance<GetImagePage>(), notNullValue())
+               assertThat(baseInjector.getInstance<GetImagePage>(), notNullValue())
        }
 
 }
index d99f569..a0e9372 100644 (file)
@@ -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<ImageBrowserPage>(), notNullValue())
+               assertThat(baseInjector.getInstance<ImageBrowserPage>(), 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"))
        }
 
 }
index ba0f216..9104127 100644 (file)
@@ -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<PostVisibilityFilter>()
@@ -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<IndexPage>(), notNullValue())
+               assertThat(baseInjector.getInstance<IndexPage>(), notNullValue())
        }
 
        @Test
        fun `page is annotated with correct menuname`() {
-           assertThat(page.menuName, equalTo("Index"))
+               assertThat(page.menuName, equalTo("Index"))
        }
 
        @Test
index a816d23..37e0e95 100644 (file)
@@ -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<KnownSonesPage>(), notNullValue())
+               assertThat(baseInjector.getInstance<KnownSonesPage>(), 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"))
        }
 
 }
index c8d7a3b..4140644 100644 (file)
@@ -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<LikePage>(), notNullValue())
+               assertThat(baseInjector.getInstance<LikePage>(), notNullValue())
        }
 
 }
index 2b80dbb..de42141 100644 (file)
@@ -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<LockSonePage>(), notNullValue())
+               assertThat(baseInjector.getInstance<LockSonePage>(), notNullValue())
        }
 
 }
index ea51d8b..067857e 100644 (file)
@@ -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<LoginPage>(), notNullValue())
+               assertThat(baseInjector.getInstance<LoginPage>(), 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"))
        }
 
 }
index ae7de0d..fae95d2 100644 (file)
@@ -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<LogoutPage>(), notNullValue())
+               assertThat(baseInjector.getInstance<LogoutPage>(), notNullValue())
        }
 
        @Test
        fun `page is annotated with correct menuname`() {
-           assertThat(page.menuName, equalTo("Logout"))
+               assertThat(page.menuName, equalTo("Logout"))
        }
 
 }
index 0bb49e0..6142e3a 100644 (file)
@@ -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<MarkAsKnownPage>(), notNullValue())
+               assertThat(baseInjector.getInstance<MarkAsKnownPage>(), notNullValue())
        }
 
 }
index ecdb3db..a4d7617 100644 (file)
@@ -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<NewPage>(), notNullValue())
+               assertThat(baseInjector.getInstance<NewPage>(), 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"))
        }
 
 }
index 853b4fb..71e1b7b 100644 (file)
@@ -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<OptionsPage>(), notNullValue())
+               assertThat(baseInjector.getInstance<OptionsPage>(), 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"))
        }
 
 }
index e32dc1b..99cf8bf 100644 (file)
@@ -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<FreenetRequest>("/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<ReloadingPage<*>>(), notNullValue())
+               assertThat(baseInjector.getInstance<ReloadingPage<*>>(), notNullValue())
        }
 
 }
index dabcbbe..d11352f 100644 (file)
@@ -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<SoneRescuer>()
 
@@ -87,17 +87,17 @@ class RescuePageTest: WebPageTest(::RescuePage) {
 
        @Test
        fun `page can be created by dependency injection`() {
-           assertThat(baseInjector.getInstance<RescuePage>(), notNullValue())
+               assertThat(baseInjector.getInstance<RescuePage>(), 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"))
        }
 
 }
index cc01a15..329f458 100644 (file)
@@ -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<Ticker>()
@@ -360,12 +360,12 @@ class SearchPageTest: WebPageTest({ webInterface, loaders, templateRenderer -> S
 
        @Test
        fun `page can be created by dependency injection`() {
-           assertThat(baseInjector.getInstance<SearchPage>(), notNullValue())
+               assertThat(baseInjector.getInstance<SearchPage>(), notNullValue())
        }
 
        @Test
        fun `page is annotated with correct template path`() {
-           assertThat(page.templatePath, equalTo("/templates/search.html"))
+               assertThat(page.templatePath, equalTo("/templates/search.html"))
        }
 
 }
index 1bfb6ff..ffb8997 100644 (file)
@@ -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))
        }
index 851762b..990c1b7 100644 (file)
@@ -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<TrustPage>(), notNullValue())
+               assertThat(baseInjector.getInstance<TrustPage>(), notNullValue())
        }
 
 }
index 0180187..4025fe4 100644 (file)
@@ -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<UnbookmarkPage>(), notNullValue())
+               assertThat(baseInjector.getInstance<UnbookmarkPage>(), notNullValue())
        }
 
 }
index 63b902b..39f4fd5 100644 (file)
@@ -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<UnfollowSonePage>(), notNullValue())
+               assertThat(baseInjector.getInstance<UnfollowSonePage>(), notNullValue())
        }
 
 }
index fa30cb0..2d8ef89 100644 (file)
@@ -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<UnlikePage>(), notNullValue())
+               assertThat(baseInjector.getInstance<UnlikePage>(), notNullValue())
        }
 
 }
index 7f839fa..8627fd4 100644 (file)
@@ -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<UnlockSonePage>(), notNullValue())
+               assertThat(baseInjector.getInstance<UnlockSonePage>(), notNullValue())
        }
 
 }
index cd11259..eb0ebdd 100644 (file)
@@ -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<UntrustPage>(), notNullValue())
+               assertThat(baseInjector.getInstance<UntrustPage>(), notNullValue())
        }
 
 }
index 13df43d..370c0a7 100644 (file)
@@ -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<Album>().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<UploadImagePage>(), notNullValue())
+               assertThat(baseInjector.getInstance<UploadImagePage>(), notNullValue())
        }
 
        @Test
        fun `page is annotated with correct template path`() {
-           assertThat(page.templatePath, equalTo("/templates/invalid.html"))
+               assertThat(page.templatePath, equalTo("/templates/invalid.html"))
        }
 
 }
index aac42d6..6ba1550 100644 (file)
@@ -12,7 +12,7 @@ import java.net.*
 /**
  * Unit test for [ViewPostPage].
  */
-class ViewPostPageTest: WebPageTest(::ViewPostPage) {
+class ViewPostPageTest : WebPageTest(::ViewPostPage) {
 
        private val post = mock<Post>()
 
@@ -99,12 +99,12 @@ class ViewPostPageTest: WebPageTest(::ViewPostPage) {
 
        @Test
        fun `page can be created by dependency injection`() {
-           assertThat(baseInjector.getInstance<ViewPostPage>(), notNullValue())
+               assertThat(baseInjector.getInstance<ViewPostPage>(), notNullValue())
        }
 
        @Test
        fun `page is annotated with correct template path`() {
-           assertThat(page.templatePath, equalTo("/templates/viewPost.html"))
+               assertThat(page.templatePath, equalTo("/templates/viewPost.html"))
        }
 
 }
index f40bb25..6e97e36 100644 (file)
@@ -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<ViewSonePage>(), notNullValue())
+               assertThat(baseInjector.getInstance<ViewSonePage>(), notNullValue())
        }
 
        @Test
        fun `page is annotated with correct template path`() {
-           assertThat(page.templatePath, equalTo("/templates/viewSone.html"))
+               assertThat(page.templatePath, equalTo("/templates/viewSone.html"))
        }
 
 }
index fc63959..f51bece 100644 (file)
@@ -47,11 +47,13 @@ open class WebPageTest(pageSupplier: (WebInterface, Loaders, TemplateRenderer) -
 
        val httpRequest = mock<HTTPRequest>()
        val freenetRequest = mock<FreenetRequest>()
+
        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<ToadletContext>()
@@ -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<String>(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)