- protected fun addNewPost(id: String, soneId: String, time: Long, recipientId: String? = null) {
- newPosts[id] = mock<Post>().apply {
- whenever(this.id).thenReturn(id)
- val sone = mock<Sone>().apply { whenever(this.id).thenReturn(soneId) }
- whenever(this.sone).thenReturn(sone)
- whenever(this.time).thenReturn(time)
- whenever(this.recipientId).thenReturn(recipientId.asOptional())
- }
+ protected fun addSone(sone: Sone, soneId: String? = null) {
+ remoteSones += (soneId ?: sone.id) to sone
+ }
+
+ protected fun addLocalSone(id: String, sone: Sone) {
+ localSones += id to sone
+ }
+
+ protected fun addPost(id: String, post: Post) {
+ posts[id] = post
+ }
+
+ protected fun addNewPost(id: String, soneId: String, time: Long, recipientId: String? = null) =
+ mock<Post>().apply {
+ whenever(this.id).thenReturn(id)
+ val sone = mock<Sone>().apply { whenever(this.id).thenReturn(soneId) }
+ whenever(this.sone).thenReturn(sone)
+ whenever(this.time).thenReturn(time)
+ whenever(this.recipientId).thenReturn(recipientId.asOptional())
+ }.also { newPosts[id] = it }
+
+ protected fun addReply(id: String, reply: PostReply) {
+ replies[id] = reply