You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please note this behaviour depends on the version of Kotlin being used. If 1.6.10 is used, Jacoco reports 100% coverage. If 1.6.21 or 1.7.10 is used Jacoco incorrectly reports a missing branch on this line return street?.house ?: throw IllegalArgumentException("unknown key $key")
data classHouse(valline1:String)
data classStreet(valhouse:House)
classBug {
funmapCheck(key:String): House {
val map =mapOf("A" to Street(House("10 London Road")))
val street = map[key]
return street?.house ?:throwIllegalArgumentException("unknown key $key")
}
}
importio.kotest.assertions.throwables.shouldThrowimportio.kotest.matchers.nulls.shouldNotBeNullimportio.kotest.matchers.shouldBeimportorg.junit.jupiter.api.TestinternalclassBugTest {
val bug =Bug()
@Test
fun`get key works`() {
bug.mapCheck("A").line1 shouldBe "10 London Road"
}
@Test
fun`get key throws exception`() {
shouldThrow<IllegalArgumentException>{
bug.mapCheck("B")}.message shouldBe "unknown key B"
}
Expected behaviour
Should get 100% coverage on Bug class
Actual behaviour
75% coverage due to a missed branch
The text was updated successfully, but these errors were encountered:
Steps to reproduce
Please note this behaviour depends on the version of Kotlin being used. If 1.6.10 is used, Jacoco reports 100% coverage. If 1.6.21 or 1.7.10 is used Jacoco incorrectly reports a missing branch on this line
return street?.house ?: throw IllegalArgumentException("unknown key $key")
Expected behaviour
Should get 100% coverage on Bug class
Actual behaviour
75% coverage due to a missed branch
The text was updated successfully, but these errors were encountered: