X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fnotify%2FListNotificationTest.kt;h=4c820359e5bda04326ad0dfddae736f77da4f8cd;hb=80a85fb800467a7041517ed1901b59d8a3f2cccd;hp=1aa554ca2ed26559899b41653c00f700a692b3a4;hpb=15975fffc055e2acfa129ce5821d2aa0cc045717;p=Sone.git diff --git a/src/test/kotlin/net/pterodactylus/sone/notify/ListNotificationTest.kt b/src/test/kotlin/net/pterodactylus/sone/notify/ListNotificationTest.kt index 1aa554c..4c82035 100644 --- a/src/test/kotlin/net/pterodactylus/sone/notify/ListNotificationTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/notify/ListNotificationTest.kt @@ -21,6 +21,14 @@ class ListNotificationTest { } @Test + @Suppress("UNCHECKED_CAST") + fun `list in template context gets updated when elements are added`() { + listNotification.add("a") + listNotification.add("b") + assertThat(template.initialContext.get(KEY) as Iterable, contains("a", "b")) + } + + @Test fun `new list notification has no element`() { assertThat(listNotification.elements, emptyIterable()) } @@ -37,6 +45,12 @@ class ListNotificationTest { } @Test + fun `list notification deduplicates set elements`() { + listNotification.setElements(listOf("a", "b", "a")) + assertThat(listNotification.elements, contains("a", "b")) + } + + @Test fun `list notification retains added elements`() { listNotification.add("a") listNotification.add("b")