All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.copperleaf.ballast.test.internal.ScenarioResult.kt Maven / Gradle / Ivy

There is a newer version: 4.2.1
Show newest version
package com.copperleaf.ballast.test.internal

import kotlin.time.Duration

internal sealed class ScenarioResult {
    abstract val scenario: BallastScenarioScopeImpl
    abstract fun printResults(): String

    data class Passed(
        override val scenario: BallastScenarioScopeImpl,
        val time: Duration
    ) : ScenarioResult() {
        override fun printResults(): String {
            return "Scenario '${scenario.name}': Passed ($time)"
        }
    }

    data class Failed(
        override val scenario: BallastScenarioScopeImpl,
        val time: Duration,
        val reason: Throwable,
    ) : ScenarioResult() {
        override fun printResults(): String {
            return "Scenario '${scenario.name}': Failed ($time)\n  Reason: ${reason.message}"
        }
    }

    data class Skipped(
        override val scenario: BallastScenarioScopeImpl,
    ) : ScenarioResult() {
        override fun printResults(): String {
            return "Scenario '${scenario.name}': Skipped"
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy