Open
Description
Description
When user tries to generate parametrized test for Kotlin code as result she gets uncompilable code
To Reproduce
Steps to reproduce the behavior:
- Invoke test generation for the code below, with enabled setting
Parametrized tests
class A {
fun f(a:Int, b:Int): Int {
return a + b;
}
}
Expected behavior
Executable tests are generated
Actual behavior
Tests cannot be compiled and executed.
Visual proofs (screenshots, logs, images)
Resulted code and errors:
class ATest {
///region Test suites for executable org.test.A.f
///region Parameterized test for method f(int, int)
@ParameterizedTest
@MethodSource("org.test.ATest#provideDataForF")
fun parameterizedTestsForF(a: A?,
a1: Int,
b: Int,
expectedResult: Int?
) {
val actual = a.f(a1, b) // #1 error
assertEquals(expectedResult, actual)
}
///endregion
///endregion
companion object {
///region Data providers
@JvmStatic
fun provideDataForF(): java.util.ArrayList // #2 error
{
val argList = java.util.ArrayList() // #3 error
run {
val a = A()
val testCaseObjects = kotlin.Array<Any?>(4) { null }
testCaseObjects[0] = a
testCaseObjects[1] = -1
testCaseObjects[2] = 1
testCaseObjects[3] = 0
argList.add(arguments(testCaseObjects))
}
return argList
}
///endregion
}
}
Metadata
Metadata
Assignees
Type
Projects
Status
Todo