}
}
- //
- // EVENT HANDLERS
- //
-
- @Subscribe
- public void markPostKnown(MarkPostKnownEvent markPostKnownEvent) {
- removePost(markPostKnownEvent.getPost());
- }
-
- @Subscribe
- public void postRemoved(PostRemovedEvent postRemovedEvent) {
- removePost(postRemovedEvent.getPost());
- }
-
- private void removePost(Post post) {
- newPostNotification.remove(post);
- }
-
/**
* Notifies the web interface that a {@link Sone} is being inserted.
*
assertThat(remotePostHandlerTest.notifications, not(hasItem(notification)))
}
+ @Test
+ fun `handler removes post from notification if post is removed`() {
+ notification.add(remotePost)
+ remotePostHandlerTest.sendEvent(PostRemovedEvent(remotePost))
+ assertThat(notification.elements, not(hasItem(remotePost)))
+ }
+
+ @Test
+ fun `handler removes post from notification if post is marked as known`() {
+ notification.add(remotePost)
+ remotePostHandlerTest.sendEvent(MarkPostKnownEvent(remotePost))
+ assertThat(notification.elements, not(hasItem(remotePost)))
+ }
+
}
private val remoteSone: Sone = IdOnlySone("remote-sone")