com.avito.report.inmemory.OnlyLastExecutionMattersStrategy.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of report-api Show documentation
Show all versions of report-api Show documentation
Collection of infrastructure libraries and gradle plugins of Avito Android project
package com.avito.report.inmemory
import com.avito.report.model.AndroidTest
import com.avito.report.model.TestAttempt
internal class OnlyLastExecutionMattersStrategy : TestAttemptsAggregateStrategy {
override fun getTestResult(executions: Collection): AndroidTest {
require(executions.isNotEmpty()) { "TestAttemptsAggregateStrategy called with no executions" }
val sortedExecutions = executions.sortedBy { it.executionNumber }.map { it.testResult }
return sortedExecutions.last()
}
}