Skip to content

Commit d602af3

Browse files
committed
Apply review fixes
1 parent 899640a commit d602af3

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

utbot-framework/src/test/kotlin/org/utbot/examples/CodeGenerationIntegrationTest.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import org.junit.jupiter.api.extension.ExtensionContext
2929
import org.junit.jupiter.api.fail
3030
import org.junit.jupiter.engine.descriptor.ClassTestDescriptor
3131
import org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor
32+
import java.nio.file.Path
3233

3334
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
3435
@TestMethodOrder(MethodOrderer.OrderAnnotation::class)
@@ -173,6 +174,10 @@ abstract class CodeGenerationIntegrationTest(
173174

174175
private val logger = KotlinLogging.logger { }
175176

177+
@JvmStatic
178+
protected val testCaseGeneratorCache = mutableMapOf<BuildInfo, TestSpecificTestCaseGenerator>()
179+
data class BuildInfo(val buildDir: Path, val dependencyPath: String?)
180+
176181
private fun getTestPackageSize(packageName: String): Int =
177182
// filter all not disabled tests classes
178183
allRunningTestClasses

utbot-framework/src/test/kotlin/org/utbot/examples/UtModelTestCaseChecker.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,9 @@ internal abstract class UtModelTestCaseChecker(
138138
previousClassLocation = classLocation
139139
}
140140

141+
val buildInfo = CodeGenerationIntegrationTest.Companion.BuildInfo(buildDir, dependencyPath = null)
141142
val testCaseGenerator = testCaseGeneratorCache
142-
.getOrPut(buildDir) {
143+
.getOrPut(buildInfo) {
143144
TestSpecificTestCaseGenerator(
144145
buildDir,
145146
classpath = null,
@@ -150,8 +151,6 @@ internal abstract class UtModelTestCaseChecker(
150151
return testCaseGenerator.generate(method, mockStrategy)
151152
}
152153

153-
private val testCaseGeneratorCache = mutableMapOf<Path, TestSpecificTestCaseGenerator>()
154-
155154
protected inline fun <reified T> UtExecutionResult.isException(): Boolean = exceptionOrNull() is T
156155

157156
/**

utbot-framework/src/test/kotlin/org/utbot/examples/UtValueTestCaseChecker.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2490,7 +2490,7 @@ abstract class UtValueTestCaseChecker(
24902490
mockStrategy: MockStrategyApi,
24912491
additionalDependenciesClassPath: String
24922492
): UtMethodTestSet {
2493-
val buildInfo = BuildInfo(buildDir, additionalDependenciesClassPath)
2493+
val buildInfo = CodeGenerationIntegrationTest.Companion.BuildInfo(buildDir, additionalDependenciesClassPath)
24942494

24952495
val testCaseGenerator = testCaseGeneratorCache
24962496
.getOrPut(buildInfo) {
@@ -2511,7 +2511,7 @@ abstract class UtValueTestCaseChecker(
25112511
val additionalDependenciesClassPath =
25122512
computeAdditionalDependenciesClasspathAndBuildDir(method, additionalDependencies)
25132513
withUtContext(UtContext(method.clazz.java.classLoader)) {
2514-
val buildInfo = BuildInfo(buildDir, additionalDependenciesClassPath)
2514+
val buildInfo = CodeGenerationIntegrationTest.Companion.BuildInfo(buildDir, additionalDependenciesClassPath)
25152515
val testCaseGenerator = testCaseGeneratorCache
25162516
.getOrPut(buildInfo) {
25172517
TestSpecificTestCaseGenerator(
@@ -2551,9 +2551,6 @@ abstract class UtValueTestCaseChecker(
25512551
)
25522552

25532553
data class MethodResult(val testCase: UtMethodTestSet, val coverage: Coverage)
2554-
2555-
data class BuildInfo(val buildDir: Path, val dependencyPath: String)
2556-
private val testCaseGeneratorCache = mutableMapOf<BuildInfo, TestSpecificTestCaseGenerator>()
25572554
}
25582555

25592556
@Suppress("UNCHECKED_CAST")

0 commit comments

Comments
 (0)