diff --git a/utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/mapper/Utils.kt b/utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/mapper/Utils.kt index 3e3a41c71a..2ea3667575 100644 --- a/utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/mapper/Utils.kt +++ b/utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/mapper/Utils.kt @@ -1,6 +1,7 @@ package org.utbot.framework.plugin.api.mapper import org.utbot.framework.plugin.api.EnvironmentModels +import org.utbot.framework.plugin.api.MissingState import org.utbot.framework.plugin.api.UtDirectGetFieldModel import org.utbot.framework.plugin.api.UtDirectSetFieldModel import org.utbot.framework.plugin.api.UtExecutableCallModel @@ -50,12 +51,15 @@ fun UtStatementCallModel.mapModels(mapper: UtModelMapper): UtStatementCallModel ) } -fun EnvironmentModels.mapModels(mapper: UtModelMapper) = EnvironmentModels( - thisInstance = thisInstance?.map(mapper), - statics = statics.mapModelValues(mapper), - parameters = parameters.mapModels(mapper), - executableToCall = executableToCall, -) +fun EnvironmentModels.mapModels(mapper: UtModelMapper) = when (this) { + MissingState -> MissingState + else -> EnvironmentModels( + thisInstance = thisInstance?.map(mapper), + statics = statics.mapModelValues(mapper), + parameters = parameters.mapModels(mapper), + executableToCall = executableToCall, + ) +} fun UtExecutionResult.mapModelIfExists(mapper: UtModelMapper) = if (this.isSuccess) { val successResult = this as UtExecutionSuccess