aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/test/java/org/onap/vid/utils/KotlinUtilsTest.kt
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common/src/test/java/org/onap/vid/utils/KotlinUtilsTest.kt')
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/utils/KotlinUtilsTest.kt21
1 files changed, 21 insertions, 0 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/utils/KotlinUtilsTest.kt b/vid-app-common/src/test/java/org/onap/vid/utils/KotlinUtilsTest.kt
new file mode 100644
index 000000000..ac729e490
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/utils/KotlinUtilsTest.kt
@@ -0,0 +1,21 @@
+package org.onap.vid.utils
+
+import org.testng.AssertJUnit.assertEquals
+import org.testng.annotations.DataProvider
+import org.testng.annotations.Test
+
+internal class KotlinUtilsTest {
+ @DataProvider
+ fun listsAndPerdicates(): Array<Array<Any>>? {
+ return arrayOf(
+ arrayOf("stop on second item", listOf("a", "b", "c", "d"), "b", listOf("a", "b")),
+ arrayOf("return all of the list", listOf("a", "b", "c", "d"), "z", listOf("a", "b", "c", "d")),
+ arrayOf("only first item returns", listOf("a", "b", "c", "d"), "a", listOf("a")),
+ arrayOf("returns an empty list", emptyList<String>(), "z", emptyList<String>()))
+ }
+
+ @Test(dataProvider = "listsAndPerdicates")
+ fun testTakeUntilIncludingReturendValue(desc: String, list: List<String>, predicate: String, expectedResultList: List<String>) {
+ assertEquals(desc, expectedResultList, list.takeUntilIncluding { it == predicate })
+ }
+}