X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fnotification%2FLocalPostHandlerTest.kt;h=1d97ae8a342ba03a5747f720a002abfdaeb3b888;hp=d435101e534536c9e54cc200adae7ce3ee340b05;hb=c7a324e45e46ac629a5a3da5c3458bc66d18938f;hpb=146335994dc415527bc4c8ec9a0981d739444ea8 diff --git a/src/test/kotlin/net/pterodactylus/sone/web/notification/LocalPostHandlerTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/notification/LocalPostHandlerTest.kt index d435101..1d97ae8 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/notification/LocalPostHandlerTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/notification/LocalPostHandlerTest.kt @@ -26,7 +26,6 @@ import net.pterodactylus.util.notify.* import net.pterodactylus.util.template.* import org.hamcrest.MatcherAssert.* import org.hamcrest.Matchers.* -import java.io.* import kotlin.test.* /** @@ -55,17 +54,21 @@ class LocalPostHandlerTest { } @Test - fun `handler adds notification to manager`() { + fun `handler does not add notification to manager for post by remote sone`() { eventBus.post(NewPostFoundEvent(remotePost)) + assertThat(notificationManager.notifications, not(hasItem(notification))) + } + + @Test + fun `handler adds notification to manager`() { + eventBus.post(NewPostFoundEvent(localPost)) assertThat(notificationManager.notifications, contains(notification)) } @Test fun `handler does not add notification during first start`() { - notificationManager.addNotification(object : AbstractNotification("first-start-notification") { - override fun render(writer: Writer?) = Unit - }) - eventBus.post(NewPostFoundEvent(remotePost)) + notificationManager.firstStart() + eventBus.post(NewPostFoundEvent(localPost)) assertThat(notificationManager.notifications, not(hasItem(notification))) }