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

in.specmatic.test.reports.coverage.console.Remarks.kt Maven / Gradle / Ivy

Go to download

Run contracts as tests in Junit tests using Specmatic. Deprecation Notice for group ID "in.specmatic" ****************************************************************************************************** Updates for "junit5-support" will no longer be available under the deprecated group ID "in.specmatic". Please update your dependencies to use the new group ID "io.specmatic". ******************************************************************************************************

There is a newer version: 1.3.39
Show newest version
package `in`.specmatic.test.reports.coverage.console

import `in`.specmatic.core.TestResult
import `in`.specmatic.core.pattern.ContractException
import `in`.specmatic.test.TestResultRecord

enum class Remarks(val value: String) {
    Covered("covered"),
    Missed("missing in spec"),
    NotImplemented("not implemented"),
    DidNotRun("did not run");

    override fun toString(): String {
        return value
    }

    companion object{
        fun resolve(testResultRecords: List): Remarks {
            if (testResultRecords.any { it.isExercised }) {
                return when (testResultRecords.first().result) {
                    TestResult.NotImplemented -> NotImplemented
                    else -> Covered
                }
            }
            return when (val result = testResultRecords.first().result) {
                TestResult.Skipped -> Missed
                TestResult.DidNotRun -> DidNotRun
                else -> throw ContractException("Cannot determine remarks for unknown test result: $result")
            }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy