@@ -48,7 +48,6 @@ import kotlinx.coroutines.launch
48
48
import kotlinx.coroutines.runBlocking
49
49
import kotlinx.coroutines.yield
50
50
import mu.KotlinLogging
51
- import org.utbot.engine.*
52
51
import soot.Scene
53
52
import soot.jimple.JimpleBody
54
53
import soot.toolkits.graph.ExceptionalUnitGraph
@@ -202,12 +201,9 @@ object UtBotTestCaseGenerator : TestCaseGenerator {
202
201
): Traverser {
203
202
// TODO: create classLoader from buildDir/classpath and migrate from UtMethod to MethodId?
204
203
logger.debug(" Starting symbolic execution for $method --$mockStrategy --" )
205
- val graph = graph(method)
206
-
207
204
return Traverser (
208
205
controller,
209
206
method,
210
- graph,
211
207
classpathForEngine,
212
208
dependencyPaths = dependencyPaths,
213
209
mockStrategy = apiToModel(mockStrategy),
@@ -419,31 +415,22 @@ object UtBotTestCaseGenerator : TestCaseGenerator {
419
415
else -> error(" Cannot map API Mock Strategy model to Engine model: $mockStrategyApi " )
420
416
}
421
417
422
- private fun graph (method : UtMethod <* >): ExceptionalUnitGraph {
423
- val className = method.clazz.java.name
424
- val clazz = Scene .v().classes.singleOrNull { it.name == className }
425
- ? : error(" No such $className found in the Scene" )
426
- val signature = method.callable.signature
427
- val sootMethod = clazz.methods.singleOrNull { it.pureJavaSignature == signature }
428
- ? : error(" No such $signature found" )
429
- if (! sootMethod.canRetrieveBody()) {
430
- error(" No method body for $sootMethod found" )
431
- }
432
- val methodBody = sootMethod.jimpleBody()
433
- val graph = methodBody.graph()
434
-
435
- logger.trace { " JIMPLE for $method :\n ${methodBody} " }
418
+ }
436
419
437
- return graph
438
- }
420
+ fun graph (method : UtMethod <* >): ExceptionalUnitGraph {
421
+ val methodBody = jimpleBody(method)
422
+ return methodBody.graph()
423
+ }
439
424
440
- fun jimpleBody (method : UtMethod <* >): JimpleBody {
441
- val clazz = Scene .v().classes.single { it.name == method.clazz.java.name }
442
- val signature = method.callable.signature
443
- val sootMethod = clazz.methods.single { it.pureJavaSignature == signature }
425
+ fun jimpleBody (method : UtMethod <* >): JimpleBody {
426
+ val className = method.clazz.java.name
427
+ val clazz = Scene .v().classes.singleOrNull { it.name == className }
428
+ ? : error(" No such $className found in the Scene" )
429
+ val signature = method.callable.signature
430
+ val sootMethod = clazz.methods.singleOrNull { it.pureJavaSignature == signature }
431
+ ? : error(" No such $signature found" )
444
432
445
- return sootMethod.jimpleBody()
446
- }
433
+ return sootMethod.jimpleBody()
447
434
}
448
435
449
436
fun JimpleBody.graph () = ExceptionalUnitGraph (this )
0 commit comments