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=22648b57848a5ec71cba38c3829d775bfe133242;hp=d435101e534536c9e54cc200adae7ce3ee340b05;hb=438378deab1514f0f608d975ef65f5b7aea44ccb;hpb=5c3d55750f4d521ae15f9ad394468d8faefcd828 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..22648b5 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/notification/LocalPostHandlerTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/notification/LocalPostHandlerTest.kt @@ -1,5 +1,5 @@ /** - * Sone - NewLocalPostHandlerTest.kt - Copyright © 2019 David ‘Bombe’ Roden + * Sone - LocalPostHandlerTest.kt - Copyright © 2019–2020 David ‘Bombe’ Roden * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -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))) }