@Test
fun `sender can be chosen from local sones`() {
val sone = mock<Sone>().apply { whenever(id).thenReturn("local-sone") }
- addLocalSone("local-sone", sone)
+ addLocalSone(sone)
val post = mock<Post>()
addPost(post, "post-id")
val reply = mock<PostReply>().apply { whenever(id).thenReturn("reply-id") }
remoteSones += (soneId ?: sone.id) to sone
}
- protected fun addLocalSone(id: String, sone: Sone) {
- localSones += id to sone
+ protected fun addLocalSone(sone: Sone, id: String? = null) {
+ localSones[id ?: sone.id] = sone
}
protected fun addPost(post: Post, id: String? = null) {
@Test
fun `request with valid sone id results in locked sone`() {
val sone = mock<Sone>()
- addLocalSone("sone-id", sone)
+ addLocalSone(sone, "sone-id")
addRequestParameter("sone", "sone-id")
assertThat(json.isSuccess, equalTo(true))
verify(core).lockSone(sone)