/**
* Unit test for [CreatePostPage].
*/
-class CreatePostPageTest: WebPageTest(::CreatePostPage) {
+class CreatePostPageTest : WebPageTest(::CreatePostPage) {
@Test
fun `page returns correct path`() {
addHttpRequestPart("returnPage", "return.html")
addHttpRequestPart("text", "post text")
verifyRedirect("return.html") {
- verify(core).createPost(currentSone, absent(), "post text")
+ verify(core).createPost(currentSone, null, "post text")
}
}
val sender = mock<Sone>()
addLocalSone("sender-id", sender)
verifyRedirect("return.html") {
- verify(core).createPost(sender, absent(), "post text")
+ verify(core).createPost(sender, null, "post text")
}
}
val recipient = mock<Sone>()
addSone("recipient-id", recipient)
verifyRedirect("return.html") {
- verify(core).createPost(currentSone, recipient.asOptional(), "post text")
+ verify(core).createPost(currentSone, recipient, "post text")
}
}
addHttpRequestPart("text", "post http://localhost:12345/KSK@foo text")
addHttpRequestHeader("Host", "localhost:12345")
verifyRedirect("return.html") {
- verify(core).createPost(currentSone, absent(), "post KSK@foo text")
+ verify(core).createPost(currentSone, null, "post KSK@foo text")
}
}
@Test
fun `page can be created by dependency injection`() {
- assertThat(baseInjector.getInstance<CreatePostPage>(), notNullValue())
+ assertThat(baseInjector.getInstance<CreatePostPage>(), notNullValue())
}
@Test
fun `page is annotated with correct template path`() {
- assertThat(page.templatePath, equalTo("/templates/createPost.html"))
+ assertThat(page.templatePath, equalTo("/templates/createPost.html"))
}
}