mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-17 08:31:29 +00:00
21 lines
508 B
Kotlin
21 lines
508 B
Kotlin
package test.language
|
|
|
|
import junit.framework.TestCase
|
|
import java.util.Collection
|
|
import kotlin.test.*
|
|
|
|
class NullableCollectionsTest : TestCase() {
|
|
|
|
fun testIterateOverNullCollectionsThrowsNPE() {
|
|
val c: Collection<String>? = null
|
|
|
|
// TODO currently this will throw a NPE
|
|
// should it either be a compile error or handle nulls gracefully?
|
|
failsWith<NullPointerException> {
|
|
for (e in c) {
|
|
println("Hey got $e")
|
|
}
|
|
}
|
|
}
|
|
}
|