X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Ftext%2FSoneMentionDetectorTest.kt;h=a56e5b5b20c34218a9f95e33ad327c74dead1f0f;hp=2003988d756addea14ff7fb52cfaa109b094aa91;hb=0a2f92314bc1f78a6dea24dc353dd8ad3b041cb9;hpb=acdc9746bb0c853bfd36f1c982c95017158166c2 diff --git a/src/test/kotlin/net/pterodactylus/sone/text/SoneMentionDetectorTest.kt b/src/test/kotlin/net/pterodactylus/sone/text/SoneMentionDetectorTest.kt index 2003988..a56e5b5 100644 --- a/src/test/kotlin/net/pterodactylus/sone/text/SoneMentionDetectorTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/text/SoneMentionDetectorTest.kt @@ -37,14 +37,14 @@ class SoneMentionDetectorTest { private val soneProvider = TestSoneProvider() private val postProvider = TestPostProvider() private val soneTextParser = SoneTextParser(soneProvider, postProvider) - private val capturedEvents = mutableListOf() + private val capturedEvents = mutableListOf() init { eventBus.register(SoneMentionDetector(eventBus, soneTextParser)) eventBus.register(object : Any() { @Subscribe - fun captureEvent(localSoneMentionedInPostEvent: LocalSoneMentionedInPostEvent) { - capturedEvents += localSoneMentionedInPostEvent + fun captureEvent(mentionOfLocalSoneFoundEvent: MentionOfLocalSoneFoundEvent) { + capturedEvents += mentionOfLocalSoneFoundEvent } }) } @@ -67,21 +67,21 @@ class SoneMentionDetectorTest { fun `detector emits event on post that contains links to a remote and a local sone`() { val post = createPost("text mentions sone://${localSone1.id} and sone://${remoteSone2.id}.") eventBus.post(NewPostFoundEvent(post)) - assertThat(capturedEvents, contains(LocalSoneMentionedInPostEvent(post))) + assertThat(capturedEvents, contains(MentionOfLocalSoneFoundEvent(post))) } @Test fun `detector emits one event on post that contains two links to the same local sone`() { val post = createPost("text mentions sone://${localSone1.id} and sone://${localSone1.id}.") eventBus.post(NewPostFoundEvent(post)) - assertThat(capturedEvents, contains(LocalSoneMentionedInPostEvent(post))) + assertThat(capturedEvents, contains(MentionOfLocalSoneFoundEvent(post))) } @Test fun `detector emits one event on post that contains links to two local sones`() { val post = createPost("text mentions sone://${localSone1.id} and sone://${localSone2.id}.") eventBus.post(NewPostFoundEvent(post)) - assertThat(capturedEvents, contains(LocalSoneMentionedInPostEvent(post))) + assertThat(capturedEvents, contains(MentionOfLocalSoneFoundEvent(post))) } @Test @@ -110,7 +110,7 @@ class SoneMentionDetectorTest { 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))) + assertThat(capturedEvents, contains(MentionOfLocalSoneFoundEvent(post))) } @Test @@ -118,7 +118,7 @@ class SoneMentionDetectorTest { 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))) + assertThat(capturedEvents, contains(MentionOfLocalSoneFoundEvent(post))) } @Test @@ -126,7 +126,7 @@ class SoneMentionDetectorTest { 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))) + assertThat(capturedEvents, contains(MentionOfLocalSoneFoundEvent(post))) } @Test