/**
- * 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
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.*
}
@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)