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

in.specmatic.test.reports.coverage.json.OpenApiCoverageJsonRow.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.json

import `in`.specmatic.test.TestResultRecord
import `in`.specmatic.test.reports.coverage.console.Remarks
import kotlinx.serialization.Serializable

@Serializable
class OpenApiCoverageJsonRow {
    private val type: String?
    private val repository: String?
    private val branch: String?
    private val specification: String?
    private val serviceType: String?
    private val operations: List

    constructor(
        type: String?,
        repository: String?,
        branch: String?,
        specification: String?,
        serviceType: String?,
        testResults: List
    ) {
        this.type = type
        this.repository = repository
        this.branch = branch
        this.specification = specification
        this.serviceType = serviceType
        this.operations = buildOpenApiCoverageOperations(testResults)
    }

    private fun buildOpenApiCoverageOperations(testResults: List): List =
        testResults.groupBy {
            Triple(it.path, it.method, it.responseStatus)
        }.map { (operationGroup, operationRows) ->
            OpenApiCoverageOperation(
                path = operationGroup.first,
                method = operationGroup.second,
                responseCode = operationGroup.third,
                count = operationRows.count { it.isExercised },
                coverageStatus = Remarks.resolve(operationRows).toString()
            )
        }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy