1 package net.pterodactylus.sone.template
3 import org.hamcrest.MatcherAssert.assertThat
4 import org.hamcrest.Matchers.equalTo
8 * Unit test for [UniqueElementFilter].
10 class UniqueElementFilterTest {
12 private val filter = UniqueElementFilter()
15 fun `filter returns object if object is not a collection`() {
16 val someObject = Any()
17 assertThat(filter.format(null, someObject, null), equalTo<Any>(someObject))
21 fun `filter returns a set containing all unique elements of a given collection`() {
22 val objects = listOf(Any(), Any(), Any())
23 val collection = listOf(objects[0], objects[1], objects[2], objects[0], objects[1])
24 assertThat(filter.format(null, collection, null), equalTo<Any>(objects.toSet()))