projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
๐ Donโt show notification for remote posts
[Sone.git]
/
src
/
test
/
kotlin
/
net
/
pterodactylus
/
sone
/
web
/
notification
/
LocalPostHandlerTest.kt
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
(file)
--- 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 net.pterodactylus.util.template.*
import org.hamcrest.MatcherAssert.*
import org.hamcrest.Matchers.*
-import java.io.*
import kotlin.test.*
/**
import kotlin.test.*
/**
@@
-55,17
+54,21
@@
class LocalPostHandlerTest {
}
@Test
}
@Test
- fun `handler
adds notification to manager
`() {
+ fun `handler
does not add notification to manager for post by remote sone
`() {
eventBus.post(NewPostFoundEvent(remotePost))
eventBus.post(NewPostFoundEvent(remotePost))
+ assertThat(notificationManager.notifications, not(hasItem<Notification>(notification)))
+ }
+
+ @Test
+ fun `handler adds notification to manager`() {
+ eventBus.post(NewPostFoundEvent(localPost))
assertThat(notificationManager.notifications, contains<Notification>(notification))
}
@Test
fun `handler does not add notification during first start`() {
assertThat(notificationManager.notifications, contains<Notification>(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>(notification)))
}
assertThat(notificationManager.notifications, not(hasItem<Notification>(notification)))
}