diff --git a/kex-runner/src/main/kotlin/org/vorpal/research/kex/reanimator/codegen/JUnitTestCasePrinter.kt b/kex-runner/src/main/kotlin/org/vorpal/research/kex/reanimator/codegen/JUnitTestCasePrinter.kt index 8c1786711..c67818cd2 100644 --- a/kex-runner/src/main/kotlin/org/vorpal/research/kex/reanimator/codegen/JUnitTestCasePrinter.kt +++ b/kex-runner/src/main/kotlin/org/vorpal/research/kex/reanimator/codegen/JUnitTestCasePrinter.kt @@ -32,7 +32,10 @@ val Method.validName get() = name.replace(Regex("[^a-zA-Z0-9]"), "") val BasicBlock.validName get() = name.toString().replace(Regex("[^a-zA-Z0-9]"), "") -val Method.packageName get() = klass.pkg.concreteName +// If there is no package assign an arbitrary package name 'example' +// This is necessary since tests generated by kex use the same package structure and imports are made from helper files +// In java imports are not possible from the default package +val Method.packageName get() = klass.pkg.concreteName.ifBlank { kexConfig.getStringValue("testGen", "defaultPackageName", "example") } val Method.klassName get() = "${klass.validName}_${validName}_${abs(hashCode())}" abstract class TestCasePrinter( diff --git a/kex.ini b/kex.ini index 76aa969a4..9d3b7e48c 100644 --- a/kex.ini +++ b/kex.ini @@ -22,6 +22,7 @@ compileDir = compiled/ [testGen] enabled = true testsDir = tests/ +defaultPackageName = example accessLevel = private testCaseLanguage = java generateSetup = true