projects
/
Sone.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
6dba647
)
Add test for DI constructability of MoveProfileFieldAjaxPage
author
David ‘Bombe’ Roden
<bombe@pterodactylus.net>
Thu, 25 Jan 2018 18:23:39 +0000
(19:23 +0100)
committer
David ‘Bombe’ Roden
<bombe@pterodactylus.net>
Thu, 25 Jan 2018 18:30:53 +0000
(19:30 +0100)
src/main/kotlin/net/pterodactylus/sone/web/ajax/MoveProfileFieldAjaxPage.kt
patch
|
blob
|
history
src/test/kotlin/net/pterodactylus/sone/web/ajax/MoveProfileFieldAjaxPageTest.kt
patch
|
blob
|
history
diff --git
a/src/main/kotlin/net/pterodactylus/sone/web/ajax/MoveProfileFieldAjaxPage.kt
b/src/main/kotlin/net/pterodactylus/sone/web/ajax/MoveProfileFieldAjaxPage.kt
index
1c050bf
..
6bc129b
100644
(file)
--- a/
src/main/kotlin/net/pterodactylus/sone/web/ajax/MoveProfileFieldAjaxPage.kt
+++ b/
src/main/kotlin/net/pterodactylus/sone/web/ajax/MoveProfileFieldAjaxPage.kt
@@
-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 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.
/**
* 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)
*/
* @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 ->
override fun createJsonObject(currentSone: Sone, request: FreenetRequest) =
currentSone.profile.let { profile ->
diff --git
a/src/test/kotlin/net/pterodactylus/sone/web/ajax/MoveProfileFieldAjaxPageTest.kt
b/src/test/kotlin/net/pterodactylus/sone/web/ajax/MoveProfileFieldAjaxPageTest.kt
index
aab1bbe
..
847b82c
100644
(file)
--- a/
src/test/kotlin/net/pterodactylus/sone/web/ajax/MoveProfileFieldAjaxPageTest.kt
+++ b/
src/test/kotlin/net/pterodactylus/sone/web/ajax/MoveProfileFieldAjaxPageTest.kt
@@
-1,7
+1,10
@@
package net.pterodactylus.sone.web.ajax
package net.pterodactylus.sone.web.ajax
+import net.pterodactylus.sone.test.getInstance
+import net.pterodactylus.sone.web.baseInjector
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.equalTo
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.equalTo
+import org.hamcrest.Matchers.notNullValue
import org.junit.Test
import org.mockito.Mockito.verify
import org.junit.Test
import org.mockito.Mockito.verify
@@
-62,4
+65,9
@@
class MoveProfileFieldAjaxPageTest : JsonPageTest("moveProfileField.ajax", true,
verify(currentSone).profile = profile
}
verify(currentSone).profile = profile
}
+ @Test
+ fun `page can be created by dependency injection`() {
+ assertThat(baseInjector.getInstance<MoveProfileFieldAjaxPage>(), notNullValue())
+ }
+
}
}