@@ -39,6 +39,7 @@ import org.utbot.framework.plugin.api.ClassId
39
39
import org.utbot.framework.plugin.api.MethodId
40
40
import org.utbot.framework.plugin.api.UtExecutionSuccess
41
41
import org.utbot.framework.plugin.api.UtMethodTestSet
42
+ import org.utbot.framework.plugin.api.UtSymbolicExecution
42
43
import org.utbot.framework.plugin.api.util.description
43
44
import org.utbot.framework.plugin.api.util.humanReadableName
44
45
import org.utbot.fuzzer.UtFuzzedExecution
@@ -211,18 +212,35 @@ internal class CgTestClassConstructor(val context: CgContext) :
211
212
)
212
213
}
213
214
215
+ regions + = CgSimpleRegion (
216
+ " Tests for method ${methodUnderTest.humanReadableName} that cannot be presented as parameterized" ,
217
+ collectAdditionalTestsForParameterizedMode(testSet),
218
+ )
219
+ }
220
+
221
+ private fun collectAdditionalTestsForParameterizedMode (testSet : CgMethodTestSet ): List <CgTestMethod > {
222
+ val (methodUnderTest, _, _, _) = testSet
223
+ val testCaseTestMethods = mutableListOf<CgTestMethod >()
224
+
214
225
// We cannot track mocking in fuzzed executions,
215
226
// so we generate standard tests for each [UtFuzzedExecution].
216
227
// [https://github.com/UnitTestBot/UTBotJava/issues/1137]
217
- val testCaseTestMethods = mutableListOf<CgTestMethod >()
218
- for (execution in testSet.executions.filterIsInstance<UtFuzzedExecution >()) {
219
- testCaseTestMethods + = methodConstructor.createTestMethod(methodUnderTest, execution)
220
- }
228
+ testSet.executions
229
+ .filterIsInstance<UtFuzzedExecution >()
230
+ .forEach { execution ->
231
+ testCaseTestMethods + = methodConstructor.createTestMethod(methodUnderTest, execution)
232
+ }
221
233
222
- regions + = CgSimpleRegion (
223
- " FUZZER: EXECUTIONS for method ${methodUnderTest.humanReadableName} " ,
224
- testCaseTestMethods,
225
- )
234
+ // Also, we generate standard tests for symbolic executions with force mocking.
235
+ // [https://github.com/UnitTestBot/UTBotJava/issues/1231]
236
+ testSet.executions
237
+ .filterIsInstance<UtSymbolicExecution >()
238
+ .filter { it.containsMocking }
239
+ .forEach { execution ->
240
+ testCaseTestMethods + = methodConstructor.createTestMethod(methodUnderTest, execution)
241
+ }
242
+
243
+ return testCaseTestMethods
226
244
}
227
245
228
246
/* *
0 commit comments