/**
* Base class for web page tests.
*/
-open class WebPageTest(pageSupplier: (Template, WebInterface) -> SoneTemplatePage = { _, _ -> mock<SoneTemplatePage>() }) {
+open class WebPageTest(pageSupplier: (Template, WebInterface) -> SoneTemplatePage = { _, _ -> mock() }) {
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!!
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.getPost(anyString())).then { allPosts[it[0]] }
+ 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]]}
}
fun addHttpRequestParameter(name: String, value: String) {
- getRequestParameters[name] = getRequestParameters.getOrElse(name) { mutableListOf<String>() }.apply { add(value) }
+ getRequestParameters[name] = getRequestParameters.getOrElse(name) { mutableListOf() }.apply { add(value) }
}
fun addHttpRequestPart(name: String, value: String) {