in.specmatic.test.reports.coverage.console.Remarks.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of junit5-support Show documentation
Show all versions of junit5-support Show documentation
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".
******************************************************************************************************
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")
}
}
}
}