Return a nullable PostReply instead of an Optional
[Sone.git] / src / test / kotlin / net / pterodactylus / sone / web / ajax / TestObjects.kt
index a7e0a8a..0dbbeaf 100644 (file)
@@ -1,5 +1,6 @@
 package net.pterodactylus.sone.web.ajax
 
+import com.fasterxml.jackson.databind.ObjectMapper
 import com.google.common.eventbus.EventBus
 import freenet.clients.http.ToadletContext
 import freenet.l10n.BaseL10n
@@ -39,6 +40,8 @@ import javax.naming.SizeLimitExceededException
  */
 open class TestObjects {
 
+       val objectMapper = ObjectMapper()
+
        val webInterface = mock<WebInterface>()
        var formPassword = "form-password"
        val l10n = mock<BaseL10n>()
@@ -88,12 +91,12 @@ open class TestObjects {
 
                whenever(core.preferences).thenReturn(preferences)
                whenever(core.updateChecker).thenReturn(updateChecker)
-               whenever(core.getSone(ArgumentMatchers.anyString())).thenAnswer { (localSones + remoteSones)[it.getArgument(0)].asOptional() }
+               whenever(core.getSone(ArgumentMatchers.anyString())).thenAnswer { (localSones + remoteSones)[it.getArgument(0)] }
                whenever(core.getLocalSone(ArgumentMatchers.anyString())).thenAnswer { localSones[it[0]] }
                whenever(core.getPost(ArgumentMatchers.anyString())).thenAnswer { (posts + newPosts)[it[0]].asOptional() }
                whenever(core.getLikes(ArgumentMatchers.any<Post>())).then { postLikes[it[0]] ?: emptySet<Sone>() }
                whenever(core.getLikes(ArgumentMatchers.any<PostReply>())).then { replyLikes[it[0]] ?: emptySet<Sone>() }
-               whenever(core.getPostReply(ArgumentMatchers.anyString())).then { replies[it[0]].asOptional() }
+               whenever(core.getPostReply(ArgumentMatchers.anyString())).then { replies[it[0]] }
                whenever(core.getAlbum(ArgumentMatchers.anyString())).then { albums[it[0]] }
                whenever(core.getImage(ArgumentMatchers.anyString())).then { images[it[0]] }
                whenever(core.getImage(ArgumentMatchers.anyString(), ArgumentMatchers.anyBoolean())).then { images[it[0]] }