+ @Test
+ fun `detector does not emit event for reply that contains no sones`() {
+ val reply = emptyPostReply()
+ eventBus.post(NewPostReplyFoundEvent(reply))
+ assertThat(capturedEvents, emptyIterable())
+ }
+
+ @Test
+ fun `detector does not emit event for reply that contains two links to remote sones`() {
+ val reply = emptyPostReply("text mentions sone://${remoteSone1.id} and sone://${remoteSone2.id}.")
+ eventBus.post(NewPostReplyFoundEvent(reply))
+ assertThat(capturedEvents, emptyIterable())
+ }
+
+ @Test
+ fun `detector emits event on reply that contains links to a remote and a local sone`() {
+ val post = createPost()
+ val reply = emptyPostReply("text mentions sone://${remoteSone1.id} and sone://${localSone1.id}.", post)
+ eventBus.post(NewPostReplyFoundEvent(reply))
+ assertThat(capturedEvents, contains(LocalSoneMentionedInPostEvent(post)))
+ }
+
+ @Test
+ fun `detector emits one event on reply that contains two links to the same local sone`() {
+ val post = createPost()
+ val reply = emptyPostReply("text mentions sone://${localSone1.id} and sone://${localSone1.id}.", post)
+ eventBus.post(NewPostReplyFoundEvent(reply))
+ assertThat(capturedEvents, contains(LocalSoneMentionedInPostEvent(post)))
+ }
+
+ @Test
+ fun `detector emits one event on reply that contains two links to local sones`() {
+ val post = createPost()
+ val reply = emptyPostReply("text mentions sone://${localSone1.id} and sone://${localSone2.id}.", post)
+ eventBus.post(NewPostReplyFoundEvent(reply))
+ assertThat(capturedEvents, contains(LocalSoneMentionedInPostEvent(post)))
+ }
+
+ @Test
+ fun `detector does not emit event for reply by local sone`() {
+ val reply = emptyPostReply("text mentions sone://${localSone1.id} and sone://${localSone2.id}.", sone = localSone1)
+ eventBus.post(NewPostReplyFoundEvent(reply))
+ assertThat(capturedEvents, emptyIterable())
+ }
+