@@ -393,6 +393,12 @@ class UtBotSymbolicEngine(
393
393
val fallbackModelProvider = FallbackModelProvider (defaultIdGenerator)
394
394
val constantValues = collectConstantsForFuzzer(graph)
395
395
396
+ val syntheticMethodForFuzzingThisInstanceDescription =
397
+ FuzzedMethodDescription (" thisInstance" , voidClassId, listOf (classUnderTest), constantValues).apply {
398
+ className = classUnderTest.simpleName
399
+ packageName = classUnderTest.packageName
400
+ }
401
+
396
402
val random = Random (0 )
397
403
val thisInstance = when {
398
404
methodUnderTest.isStatic -> null
@@ -406,7 +412,7 @@ class UtBotSymbolicEngine(
406
412
}
407
413
else -> {
408
414
ObjectModelProvider (defaultIdGenerator).withFallback(fallbackModelProvider).generate(
409
- FuzzedMethodDescription ( " thisInstance " , voidClassId, listOf (classUnderTest), constantValues)
415
+ syntheticMethodForFuzzingThisInstanceDescription
410
416
).take(10 ).shuffled(random).map { it.value.model }.first().apply {
411
417
if (this is UtNullModel ) { // it will definitely fail because of NPE,
412
418
return @flow
@@ -431,11 +437,7 @@ class UtBotSymbolicEngine(
431
437
fuzz(methodUnderTestDescription, modelProvider(defaultModelProviders(defaultIdGenerator)))
432
438
} else {
433
439
// in case a method with no parameters is passed fuzzing tries to fuzz this instance with different constructors, setters and field mutators
434
- val thisMethodDescription = FuzzedMethodDescription (" thisInstance" , voidClassId, listOf (classUnderTest), constantValues).apply {
435
- className = classUnderTest.simpleName
436
- packageName = classUnderTest.packageName
437
- }
438
- fuzz(thisMethodDescription, ObjectModelProvider (defaultIdGenerator).apply {
440
+ fuzz(syntheticMethodForFuzzingThisInstanceDescription, ObjectModelProvider (defaultIdGenerator).apply {
439
441
totalLimit = 500
440
442
})
441
443
}.withMutations(
0 commit comments