diff --git a/dachlatten-flow/src/test/java/de/sipgate/waffeleisen/flow/PrintFlowKtTest.kt b/dachlatten-flow/src/test/java/de/sipgate/waffeleisen/flow/PrintFlowKtTest.kt index 4860d12..b8a51f8 100644 --- a/dachlatten-flow/src/test/java/de/sipgate/waffeleisen/flow/PrintFlowKtTest.kt +++ b/dachlatten-flow/src/test/java/de/sipgate/waffeleisen/flow/PrintFlowKtTest.kt @@ -69,6 +69,19 @@ class PrintFlowKtTest { assertEquals(expected, stringBuffer.toString()) } + @Test + fun printFlowWorksWithNullableValues() = runTest { + val flow = flowOf("first", null, "third") + + val resultPrinted = mutableListOf() + val resultPassed = flow.printFlow( + printFunc = { resultPrinted.add(it) } + ).collectAsList() + + assertEquals(listOf("first", null, "third"), resultPassed) + assertEquals(listOf("first", "null", "third"), resultPrinted) + } + private suspend fun Flow.collectAsList() = mutableListOf().apply { this@collectAsList.map(this::add).collect()