-
Notifications
You must be signed in to change notification settings - Fork 45
Closed
Labels
ctg-bugIssue is a bugIssue is a buglang-kotlinIssue is related to Kotlin language supportIssue is related to Kotlin language support
Description
Description
In case user code contains modification of collections UTBot tries to verify it with UtUtils.deepEquals method but it cannot be resolved in tests, so they cannot be compiled and executed.
To Reproduce
Steps to reproduce the behavior:
- In UTBot settings set
Generated test languagetoKotlin - Generate tests for following code
class Listing {
val list = mutableListOf<String>()
fun addValue(str:String): List<String> {
list.add(str)
return list
}
}Expected behavior
Compilable tests are supposed to be generated.
Actual behavior
Generated tests are red and can not be run
import org.utbot.runtime.utils.UtUtils.deepEquals
import org.junit.jupiter.api.Assertions.assertTrue
class PersonTest {
///region Test suites for executable examples.introduction.Person.likes
///region
/**
@utbot.classUnderTest {@link examples.introduction.Person}
* @utbot.methodUnderTest {@link examples.introduction.Person#likes(examples.introduction.Person)}
* */
@Test
@DisplayName("likes: other = Person(String)")
fun testLikes() {
val person = Person("")
val other = Person("")
val actual = (person.likes(other) as ArrayList)
val expected = ArrayList()
expected.add(other)
assertTrue(deepEquals(expected, actual))
}
...Visual proofs (screenshots, logs, images)
Additional context
I assume that problem with ArrayList() is part of #88, so doesn't describe it here
Metadata
Metadata
Assignees
Labels
ctg-bugIssue is a bugIssue is a buglang-kotlinIssue is related to Kotlin language supportIssue is related to Kotlin language support
Type
Projects
Status
Done
