Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Refactored the multiple calls
  • Loading branch information
amandelpie committed Jul 6, 2022
commit bce94d99a3662802be1baacbc2225ac665eaabf3
13 changes: 8 additions & 5 deletions utbot-summary/src/main/kotlin/org/utbot/summary/Summarization.kt
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ class Summarization(val sourceFile: File?, val invokeDescriptions: List<InvokeDe
return listOf(UtExecutionCluster(UtClusterInfo(), testCase.executions))
}

Comment thread
amandelpie marked this conversation as resolved.


// init
val sootToAST = sootToAST(testCase)
val jimpleBody = testCase.jimpleBody
val updatedExecutions = mutableListOf<UtExecution>()
val clustersToReturn = mutableListOf<UtExecutionCluster>()

// TODO: Now it excludes tests generated by Fuzzer, handle it properly, related to the https://github.com/UnitTestBot/UTBotJava/issues/428
if (testCase.executions.any { it.path.isEmpty() }) {
testCase.executions.filter { it.path.isEmpty() }.forEach {
val executionsProducedByFuzzer = getExecutionsWithEmptyPath(testCase)

if (executionsProducedByFuzzer.isNotEmpty()) {
executionsProducedByFuzzer.forEach {
logger.info {
"The path for test ${it.testMethodName} " +
"for method ${testCase.method.clazz.qualifiedName} is empty and summaries could not be generated."
Expand All @@ -89,7 +89,7 @@ class Summarization(val sourceFile: File?, val invokeDescriptions: List<InvokeDe
clustersToReturn.add(
UtExecutionCluster(
UtClusterInfo(),
testCase.executions.filter { it.path.isEmpty() }
executionsProducedByFuzzer
)
)
}
Expand Down Expand Up @@ -164,6 +164,9 @@ class Summarization(val sourceFile: File?, val invokeDescriptions: List<InvokeDe
return listOf(UtExecutionCluster(UtClusterInfo(), testCase.executions))
}

private fun getExecutionsWithEmptyPath(testCase: UtTestCase) =
testCase.executions.filter { it.path.isEmpty() }

/*
* asts of invokes also included
* */
Expand Down