BAEL-3323 new check added to example
This commit is contained in:
parent
30bf670ba4
commit
0478d46007
@ -2,6 +2,7 @@ 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.assertFalse
|
||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class ListsUnitTest {
|
class ListsUnitTest {
|
||||||
@ -26,7 +27,8 @@ class ListsUnitTest {
|
|||||||
fun whenFilterNotWithPredicate_thenMatchingItemsAreReturned() {
|
fun whenFilterNotWithPredicate_thenMatchingItemsAreReturned() {
|
||||||
//Returns a list containing only elements not matching the given predicate.
|
//Returns a list containing only elements not matching the given predicate.
|
||||||
val theMehBatmans = batmans.filterNot { actor -> actor.contains("a") }
|
val theMehBatmans = batmans.filterNot { actor -> actor.contains("a") }
|
||||||
assertTrue(!theMehBatmans.contains("Christian Bale") && !theMehBatmans.contains("Michael Keaton"))
|
assertFalse(theMehBatmans.contains("Christian Bale") && theMehBatmans.contains("Michael Keaton"))
|
||||||
|
assertTrue(theMehBatmans.contains("Ben Affleck") && theMehBatmans.contains("George Clooney"))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user