From 66fc32906500913c23091a66a8b047e00f8286e8 Mon Sep 17 00:00:00 2001 From: Edwin Fernando Date: Tue, 27 Aug 2024 09:59:09 +0100 Subject: [PATCH] can configure the default package name externally --- .../research/kex/reanimator/codegen/JUnitTestCasePrinter.kt | 2 +- kex.ini | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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 10fa061c2..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 @@ -35,7 +35,7 @@ val BasicBlock.validName get() = name.toString().replace(Regex("[^a-zA-Z0-9]"), // 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 { "example" } +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