BAEL-3323 filterNot example added. Rename package, class and file
This commit is contained in:
parent
dc9a78ab18
commit
30bf670ba4
@ -1,10 +1,10 @@
|
|||||||
package com.baeldung.lambda
|
package com.baeldung.lists
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class ListsTest {
|
class ListsUnitTest {
|
||||||
|
|
||||||
var batmans: List<String> = listOf("Christian Bale", "Michael Keaton", "Ben Affleck", "George Clooney")
|
var batmans: List<String> = listOf("Christian Bale", "Michael Keaton", "Ben Affleck", "George Clooney")
|
||||||
|
|
||||||
@ -22,4 +22,11 @@ class ListsTest {
|
|||||||
assertTrue(theCoolestBatmans.contains("Christian Bale") && theCoolestBatmans.contains("Michael Keaton"))
|
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"))
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user