Open
Description
Description
Test generation for a Kotlin function produces two identical tests with function call without parameters.
To Reproduce
- Install one of the latest builds of UnitTestBot plugin from main into IntelliJ Idea 2022.1.4
- Create a project with Kotlin support
- Use plugin to generate tests for the following Kotlin class:
const val question = "life, the universe, and everything"
const val answer = 42
public class DefaultArguments {
val tripleQuotedString = """
#question = "$question"
#answer = $answer""".trimMargin("#")
fun main() {
println(tripleQuotedString)
}
}
Expected behavior
Identical tests are supposed to be minimized - in regular cases only one test should be present in the resulting test class.
Actual behavior
Generated Kotlin test contains two identical tests.
Visual proofs (screenshots, logs, images)
The following test class is generated:
public class DefaultArgumentsTest {
///region Test suites for executable koans.DefaultArguments.main
///region
/**
* @utbot.classUnderTest {@link DefaultArguments}
* @utbot.methodUnderTest {@link DefaultArguments#main()}
*/
@Test
@DisplayName("main: arg_0 = DefaultArguments()")
public void testMain() {
DefaultArguments defaultArguments = new DefaultArguments();
defaultArguments.main();
}
///endregion
///region FUZZER: SUCCESSFUL EXECUTIONS for method main()
/**
* @utbot.classUnderTest {@link DefaultArguments}
* @utbot.methodUnderTest {@link DefaultArguments#main()}
*/
@Test
@DisplayName("main: main: arg_0 = DefaultArguments()")
public void testMain1() {
DefaultArguments defaultArguments = new DefaultArguments();
defaultArguments.main();
}
///endregion
///endregion
}
Environment
Windows 10 Pro
IDEA 2022.1.4
Metadata
Metadata
Assignees
Type
Projects
Status
Todo