}
@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<String>, contains("a", "b"))
+ }
+
+ @Test
fun `new list notification has no element`() {
assertThat(listNotification.elements, emptyIterable())
}
}
@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")
}
@Test
+ fun `list notification deduplicates elements`() {
+ listNotification.add("a")
+ listNotification.add("b")
+ listNotification.add("a")
+ assertThat(listNotification.elements, contains("a", "b"))
+ }
+
+ @Test
fun `list notification removes correct element`() {
listNotification.setElements(listOf("a", "b", "c"))
listNotification.remove("b")