Add test for DI constructability of MoveProfileFieldAjaxPage
[Sone.git] / src / main / kotlin / net / pterodactylus / sone / web / ajax / MoveProfileFieldAjaxPage.kt
index e2b039b..6bc129b 100644 (file)
@@ -6,6 +6,7 @@ import net.pterodactylus.sone.data.Sone
 import net.pterodactylus.sone.utils.parameters
 import net.pterodactylus.sone.web.WebInterface
 import net.pterodactylus.sone.web.page.FreenetRequest
+import javax.inject.Inject
 
 /**
  * AJAX page that lets the user move a profile field up or down.
@@ -13,7 +14,8 @@ import net.pterodactylus.sone.web.page.FreenetRequest
  * @see net.pterodactylus.sone.data.Profile#moveFieldUp(Field)
  * @see net.pterodactylus.sone.data.Profile#moveFieldDown(Field)
  */
-class MoveProfileFieldAjaxPage(webInterface: WebInterface) : LoggedInJsonPage("moveProfileField.ajax", webInterface) {
+class MoveProfileFieldAjaxPage @Inject constructor(webInterface: WebInterface) :
+               LoggedInJsonPage("moveProfileField.ajax", webInterface) {
 
        override fun createJsonObject(currentSone: Sone, request: FreenetRequest) =
                        currentSone.profile.let { profile ->
@@ -31,7 +33,7 @@ class MoveProfileFieldAjaxPage(webInterface: WebInterface) : LoggedInJsonPage("m
                                        else -> null
                                }?.let {
                                        currentSone.profile = profile
-                                       webInterface.core.touchConfiguration()
+                                       core.touchConfiguration()
                                        createSuccessJsonObject()
                                } ?: createErrorJsonObject("invalid-direction")
                        } catch (e: IllegalArgumentException) {