diff --git a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Field.kt b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Field.kt index a97bd240d9..b211d3c6c7 100644 --- a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Field.kt +++ b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Field.kt @@ -39,10 +39,10 @@ class FieldValueProvider( val thisInstanceValue = values.single() val thisInstanceModel = when (val model = thisInstanceValue.model) { is UtReferenceModel -> model - is UtNullModel -> return@Create nullFuzzedValue(type.classId) + is UtNullModel -> return@Create defaultFuzzedValue(type.classId) else -> { logger.warn { "This instance model can be only UtReferenceModel or UtNullModel, but $model is met" } - return@Create nullFuzzedValue(type.classId) + return@Create defaultFuzzedValue(type.classId) } } UtAssembleModel( @@ -62,7 +62,7 @@ class FieldValueProvider( } }, modify = emptySequence(), - empty = nullRoutine(type.classId) + empty = defaultValueRoutine(type.classId) ) ) } \ No newline at end of file diff --git a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Utils.kt b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Utils.kt index a6317ce518..3e00a45c15 100644 --- a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Utils.kt +++ b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Utils.kt @@ -2,6 +2,7 @@ package org.utbot.fuzzing.providers import org.utbot.framework.plugin.api.ClassId import org.utbot.framework.plugin.api.UtNullModel +import org.utbot.framework.plugin.api.util.defaultValueModel import org.utbot.fuzzer.FuzzedType import org.utbot.fuzzer.FuzzedValue import org.utbot.fuzzer.fuzzed @@ -11,4 +12,10 @@ fun nullRoutine(classId: ClassId): Routine.Empty = Routine.Empty { nullFuzzedValue(classId) } fun nullFuzzedValue(classId: ClassId): FuzzedValue = - UtNullModel(classId).fuzzed { summary = "%var% = null" } \ No newline at end of file + UtNullModel(classId).fuzzed { summary = "%var% = null" } + +fun defaultValueRoutine(classId: ClassId): Routine.Empty = + Routine.Empty { defaultFuzzedValue(classId) } + +fun defaultFuzzedValue(classId: ClassId): FuzzedValue = + classId.defaultValueModel().fuzzed { summary = "%var% = $model" } \ No newline at end of file