diff --git a/core-kotlin-2/src/test/kotlin/com/baeldung/lists/ListsTest.kt b/core-kotlin-2/src/test/kotlin/com/baeldung/lists/ListsUnitTest.kt similarity index 68% rename from core-kotlin-2/src/test/kotlin/com/baeldung/lists/ListsTest.kt rename to core-kotlin-2/src/test/kotlin/com/baeldung/lists/ListsUnitTest.kt index 8515a6f078..1e7136d08b 100644 --- a/core-kotlin-2/src/test/kotlin/com/baeldung/lists/ListsTest.kt +++ b/core-kotlin-2/src/test/kotlin/com/baeldung/lists/ListsUnitTest.kt @@ -1,10 +1,10 @@ -package com.baeldung.lambda +package com.baeldung.lists import org.junit.jupiter.api.Test import kotlin.test.assertEquals import kotlin.test.assertTrue -class ListsTest { +class ListsUnitTest { var batmans: List = listOf("Christian Bale", "Michael Keaton", "Ben Affleck", "George Clooney") @@ -22,4 +22,11 @@ class ListsTest { assertTrue(theCoolestBatmans.contains("Christian Bale") && theCoolestBatmans.contains("Michael Keaton")) } + @Test + fun whenFilterNotWithPredicate_thenMatchingItemsAreReturned() { + //Returns a list containing only elements not matching the given predicate. + val theMehBatmans = batmans.filterNot { actor -> actor.contains("a") } + assertTrue(!theMehBatmans.contains("Christian Bale") && !theMehBatmans.contains("Michael Keaton")) + } + } \ No newline at end of file