Skip to content

Commit cec1209

Browse files
committed
wip
1 parent d31e90f commit cec1209

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

utbot-framework-test/src/test/kotlin/org/utbot/examples/objects/AnonymousClassesExampleTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import org.utbot.tests.infrastructure.TestExecution
1212
class AnonymousClassesExampleTest : UtValueTestCaseChecker(
1313
testClass = AnonymousClassesExample::class,
1414
pipelines = listOf(
15-
TestLastStage(CodegenLanguage.JAVA, lastStage = TestExecution, parameterizedModeLastStage = Compilation),
16-
TestLastStage(CodegenLanguage.KOTLIN, lastStage = TestExecution)
15+
TestLastStage(CodegenLanguage.JAVA),
16+
TestLastStage(CodegenLanguage.KOTLIN)
1717
)
1818
) {
1919
@Test

utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/CgMethodTestSet.kt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,19 @@ data class CgMethodTestSet constructor(
130130
val executionsByStaticsUsage: Map<Set<FieldId>, List<UtExecution>> =
131131
executions.groupBy { it.stateBefore.statics.keys }
132132

133-
return executionsByStaticsUsage.map { (_, executions) -> substituteExecutions(executions) }
133+
val listOfLists = mutableListOf<List<UtExecution>>()
134+
135+
for ((_, list) in executionsByStaticsUsage) {
136+
list.groupBy { it.stateBefore.statics.values }
137+
.values
138+
.forEach {
139+
listOfLists.add(it)
140+
}
141+
}
142+
143+
return listOfLists.map { executions -> substituteExecutions(executions) }
144+
145+
// return executionsByStaticsUsage.map { (_, executions) -> substituteExecutions(executions) }
134146
}
135147

136148
/**

utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/util/CgStatementConstructor.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ import org.utbot.framework.plugin.api.util.fieldClassId
7373
import org.utbot.framework.plugin.api.util.isPrimitive
7474
import org.utbot.framework.plugin.api.util.methodClassId
7575
import org.utbot.framework.plugin.api.util.denotableType
76+
import org.utbot.framework.plugin.api.util.supertypeOfAnonymousClass
7677
import java.lang.reflect.Constructor
7778
import java.lang.reflect.Method
7879
import kotlin.reflect.KFunction
@@ -484,7 +485,11 @@ internal class CgStatementConstructorImpl(context: CgContext) :
484485
}
485486

486487
override fun wrapTypeIfRequired(baseType: ClassId): ClassId =
487-
if (baseType.isAccessibleFrom(testClassPackageName)) baseType else objectClassId
488+
when {
489+
baseType.isAccessibleFrom(testClassPackageName) -> baseType
490+
baseType.isAnonymous -> baseType.supertypeOfAnonymousClass
491+
else -> objectClassId
492+
}
488493

489494
// utils
490495

0 commit comments

Comments
 (0)