Skip to content

Commit 49820d7

Browse files
authored
Make UtExecution abstract, introduce UtFailedExecution as its child (#804)
Make `UtExecution` abstract, introduce `UtFailedExecution` as its child
1 parent 392dceb commit 49820d7

File tree

2 files changed

+24
-3
lines changed
  • utbot-framework/src/main/kotlin/org/utbot/engine
  • utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api

2 files changed

+24
-3
lines changed

utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/Api.kt

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ sealed class UtResult
144144
* - coverage information (instructions) if this execution was obtained from the concrete execution.
145145
* - comments, method names and display names created by utbot-summary module.
146146
*/
147-
open class UtExecution(
147+
abstract class UtExecution(
148148
val stateBefore: EnvironmentModels,
149149
val stateAfter: EnvironmentModels,
150150
val result: UtExecutionResult,
@@ -224,6 +224,27 @@ class UtSymbolicExecution(
224224
}
225225
}
226226

227+
/**
228+
* Execution that result in an error (e.g., JVM crash or another concrete execution error).
229+
*
230+
* Contains:
231+
* - state before the execution;
232+
* - result (a [UtExecutionFailure] or its subclass);
233+
* - coverage information (instructions) if this execution was obtained from the concrete execution.
234+
* - comments, method names and display names created by utbot-summary module.
235+
*
236+
* This execution does not contain any "after" state, as it is generally impossible to obtain
237+
* in case of failure. [MissingState] is used instead.
238+
*/
239+
class UtFailedExecution(
240+
stateBefore: EnvironmentModels,
241+
result: UtExecutionFailure,
242+
coverage: Coverage? = null,
243+
summary: List<DocStatement>? = null,
244+
testMethodName: String? = null,
245+
displayName: String? = null
246+
) : UtExecution(stateBefore, MissingState, result, coverage, summary, testMethodName, displayName)
247+
227248
open class EnvironmentModels(
228249
val thisInstance: UtModel?,
229250
val parameters: List<UtModel>,

utbot-framework/src/main/kotlin/org/utbot/engine/UtBotSymbolicEngine.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ import org.utbot.framework.plugin.api.UtAssembleModel
6868
import org.utbot.framework.plugin.api.UtConcreteExecutionFailure
6969
import org.utbot.framework.plugin.api.UtError
7070
import org.utbot.framework.plugin.api.UtExecution
71+
import org.utbot.framework.plugin.api.UtFailedExecution
7172
import org.utbot.framework.plugin.api.UtInstrumentation
7273
import org.utbot.framework.plugin.api.UtMethod
7374
import org.utbot.framework.plugin.api.UtNullModel
@@ -518,9 +519,8 @@ class UtBotSymbolicEngine(
518519
stateBefore: EnvironmentModels,
519520
e: ConcreteExecutionFailureException
520521
) {
521-
val failedConcreteExecution = UtExecution(
522+
val failedConcreteExecution = UtFailedExecution(
522523
stateBefore = stateBefore,
523-
stateAfter = MissingState,
524524
result = UtConcreteExecutionFailure(e)
525525
)
526526

0 commit comments

Comments
 (0)