Return a nullable PostReply instead of an Optional
[Sone.git] / src / test / kotlin / net / pterodactylus / sone / web / pages / WebPageTest.kt
index fc59639..2687963 100644 (file)
@@ -47,7 +47,7 @@ open class WebPageTest(pageSupplier: (Template, WebInterface) -> SoneTemplatePag
        val currentSone = mock<Sone>()
        val template = mock<Template>()
        val webInterface = deepMock<WebInterface>()
-       val core = webInterface.core!!
+       val core = webInterface.core
        val eventBus = mock<EventBus>()
        val preferences = Preferences(eventBus)
        val l10n = webInterface.l10n!!
@@ -89,11 +89,11 @@ open class WebPageTest(pageSupplier: (Template, WebInterface) -> SoneTemplatePag
                whenever(core.preferences).thenReturn(preferences)
                whenever(core.identityManager.allOwnIdentities).then { ownIdentities }
                whenever(core.sones).then { allSones.values }
-               whenever(core.getSone(anyString())).then { allSones[it[0]].asOptional() }
+               whenever(core.getSone(anyString())).then { allSones[it[0]] }
                whenever(core.localSones).then { localSones.values }
                whenever(core.getLocalSone(anyString())).then { localSones[it[0]] }
                whenever(core.getPost(anyString())).then { allPosts[it[0]].asOptional() }
-               whenever(core.getPostReply(anyString())).then { allPostReplies[it[0]].asOptional() }
+               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]]}