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=70aa709582128546c67779d306f5a296ea4addd4;hp=22648b57848a5ec71cba38c3829d775bfe133242;hb=c66657eb61d863fe2b1f1ea534a2bd46e5064b89;hpb=2debfc43a9fe69e8973b950bf1588218ac5f8df2 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 22648b5..70aa709 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/notification/LocalPostHandlerTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/notification/LocalPostHandlerTest.kt @@ -22,6 +22,7 @@ import net.pterodactylus.sone.core.event.* import net.pterodactylus.sone.data.* import net.pterodactylus.sone.data.impl.* import net.pterodactylus.sone.notify.* +import net.pterodactylus.sone.test.createPost import net.pterodactylus.util.notify.* import net.pterodactylus.util.template.* import org.hamcrest.MatcherAssert.* @@ -89,6 +90,15 @@ class LocalPostHandlerTest { } @Test + // this scenario can happen when sones are removed. + fun `handler removes post from notification if sone is missing`() { + val post = createPost(sone = null) + notification.add(post) + eventBus.post(PostRemovedEvent(post)) + assertThat(notification.elements, emptyIterable()) + } + + @Test fun `handler removes post from notification when post is marked as known`() { notification.add(localPost) notificationManager.addNotification(notification)