Closed as not planned
Description
Description
By default, Kotlin generates a private field and getter/setter for each property into bytecode. However, you can't use these getters/setters directly from Kotlin code, instead you should direct access syntax (like direct accessing field in Java). However, code produced by UTBot uses these setters/getters which lead to compilation error.
To Reproduce
Launch action on the following class:
class Sample {
var x: Int = 3;
fun f(): Int {
return x;
}
}
Expected behavior
Tests are generated correctly (in particular, access to field is written like sample.x = ...
)
Actual behavior
Generated tests are not compilable.
Visual proofs (screenshots, logs, images)
Among others, the following test is produced:
@Test
fun testF1() {
val sample = Sample()
sample.setX(-255)
val actual = sample.f()
assertEquals(-255, actual)
}
Metadata
Metadata
Assignees
Type
Projects
Status
Done