@@ -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),
@@ -414,31 +410,22 @@ object UtBotTestCaseGenerator : TestCaseGenerator {
414
410
else -> error(" Cannot map API Mock Strategy model to Engine model: $mockStrategyApi " )
415
411
}
416
412
417
- private fun graph (method : UtMethod <* >): ExceptionalUnitGraph {
418
- val className = method.clazz.java.name
419
- val clazz = Scene .v().classes.singleOrNull { it.name == className }
420
- ? : error(" No such $className found in the Scene" )
421
- val signature = method.callable.signature
422
- val sootMethod = clazz.methods.singleOrNull { it.pureJavaSignature == signature }
423
- ? : error(" No such $signature found" )
424
- if (! sootMethod.canRetrieveBody()) {
425
- error(" No method body for $sootMethod found" )
426
- }
427
- val methodBody = sootMethod.jimpleBody()
428
- val graph = methodBody.graph()
429
-
430
- logger.trace { " JIMPLE for $method :\n ${methodBody} " }
413
+ }
431
414
432
- return graph
433
- }
415
+ fun graph (method : UtMethod <* >): ExceptionalUnitGraph {
416
+ val methodBody = jimpleBody(method)
417
+ return methodBody.graph()
418
+ }
434
419
435
- fun jimpleBody (method : UtMethod <* >): JimpleBody {
436
- val clazz = Scene .v().classes.single { it.name == method.clazz.java.name }
437
- val signature = method.callable.signature
438
- val sootMethod = clazz.methods.single { it.pureJavaSignature == signature }
420
+ fun jimpleBody (method : UtMethod <* >): JimpleBody {
421
+ val className = method.clazz.java.name
422
+ val clazz = Scene .v().classes.singleOrNull { it.name == className }
423
+ ? : error(" No such $className found in the Scene" )
424
+ val signature = method.callable.signature
425
+ val sootMethod = clazz.methods.singleOrNull { it.pureJavaSignature == signature }
426
+ ? : error(" No such $signature found" )
439
427
440
- return sootMethod.jimpleBody()
441
- }
428
+ return sootMethod.jimpleBody()
442
429
}
443
430
444
431
fun JimpleBody.graph () = ExceptionalUnitGraph (this )
0 commit comments