com.deviniti.testflo.testsender.TestResultFileValidator.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of test-results-sender Show documentation
Show all versions of test-results-sender Show documentation
TestFLO - Test result sender
package com.deviniti.testflo.testsender
import com.google.gson.Gson
import java.io.File
object TestResultFileValidator {
fun isValid(testResultFile: File, testResultsType: TestResultsType): Boolean {
return when (testResultsType) {
TestResultsType.TESTNG -> TestNGValidator.validate(testResultFile)
TestResultsType.JUNIT -> JUNitValidator.validate(testResultFile)
TestResultsType.CUCUMBER -> CucumberValidator.validate(testResultFile)
TestResultsType.NUNIT -> NUnitValidator.validate(testResultFile)
}
}
}
private interface Validator {
fun validate(file: File): Boolean
}
private object JUNitValidator : Validator {
override fun validate(file: File) = file.readText().contains("