Skip to content

Commit 899640a

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

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

utbot-framework/src/main/kotlin/org/utbot/framework/plugin/api/TestCaseGenerator.kt

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,29 @@ import kotlin.coroutines.cancellation.CancellationException
4848
import kotlin.math.min
4949
import kotlin.reflect.KCallable
5050

51+
/**
52+
* Generates test cases: one by one or a whole set for the method under test.
53+
*
54+
* Note: the instantiating of [TestCaseGenerator] may take some time,
55+
* because it requires initializing Soot for the current [buildDir] and [classpath].
56+
*/
5157
open class TestCaseGenerator(
5258
private val buildDir: Path,
5359
private val classpath: String?,
5460
private val dependencyPaths: String,
5561
val engineActions: MutableList<(UtBotSymbolicEngine) -> Unit> = mutableListOf(),
5662
val isCanceled: () -> Boolean = { false },
5763
) {
58-
private lateinit var logger: KLogger
59-
private lateinit var timeoutLogger: KLogger
64+
private val logger: KLogger = KotlinLogging.logger {}
65+
private val timeoutLogger: KLogger = KotlinLogging.logger(logger.name + ".timeout")
66+
67+
private val classpathForEngine: String
68+
get() = buildDir.toString() + (classpath?.let { File.pathSeparator + it } ?: "")
6069

6170
init {
6271
if (!isCanceled()) {
6372
checkFrameworkDependencies(dependencyPaths)
6473

65-
logger = KotlinLogging.logger {}
66-
timeoutLogger = KotlinLogging.logger(logger.name + ".timeout")
67-
6874
logger.trace("Initializing ${this.javaClass.name} with buildDir = $buildDir, classpath = $classpath")
6975

7076

@@ -80,7 +86,7 @@ open class TestCaseGenerator(
8086
if (warmupConcreteExecution) {
8187
ConcreteExecutor(
8288
UtExecutionInstrumentation,
83-
classpathForEngine(),
89+
classpathForEngine,
8490
dependencyPaths
8591
).apply {
8692
classLoader = utContext.classLoader
@@ -234,8 +240,6 @@ open class TestCaseGenerator(
234240
)
235241
}
236242

237-
private fun classpathForEngine() = buildDir.toString() + (classpath?.let { File.pathSeparator + it } ?: "")
238-
239243
private fun createSymbolicEngine(
240244
controller: EngineController,
241245
method: UtMethod<*>,
@@ -248,7 +252,7 @@ open class TestCaseGenerator(
248252
return UtBotSymbolicEngine(
249253
controller,
250254
method,
251-
classpathForEngine(),
255+
classpathForEngine,
252256
dependencyPaths = dependencyPaths,
253257
mockStrategy = mockStrategyApi.toModel(),
254258
chosenClassesToMockAlways = chosenClassesToMockAlways,

utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/GenerateTestsAndSarifReportTask.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ open class GenerateTestsAndSarifReportTask @Inject constructor(
4646
return
4747
}
4848
try {
49-
5049
generateForProjectRecursively(rootGradleProject)
5150
GenerateTestsAndSarifReportFacade.mergeReports(
5251
sarifReports = rootGradleProject.collectReportsRecursively(),

0 commit comments

Comments
 (0)