Just to show some IntelliJ weirdness, here’s a JUn...
# announcements
k
Just to show some IntelliJ weirdness, here’s a JUnit 5 test case that actually works:
Copy code
@Test
        internal fun `numList is unmodifiable`() {
            val mutable: MutableList<Int> = numList as MutableList
            assertThrows<UnsupportedOperationException> { numList.add(42) }
        }
but if I comment out the line with the assignment to
mutable
— which I don’t even use — the test won’t compile. Btw, the
numList
variable is just
val numList = listOf(3, 1, 4, 1, 5, 9)
.