Skip to content
Snippets Groups Projects
Unverified Commit 87cf73d0 authored by Chilja Gossow's avatar Chilja Gossow Committed by GitHub
Browse files

Fix number of days with encounters calculation (EXPOSUREAPP-6703) (#2958)


* change calculation

* fix test fragment

Co-authored-by: default avatarI502720 <axel.herbstreith@sap.com>
parent 5e99ebb3
No related branches found
No related tags found
No related merge requests found
Showing
with 232 additions and 41 deletions
...@@ -122,23 +122,25 @@ class TestRiskLevelCalculationFragmentCWAViewModel @AssistedInject constructor( ...@@ -122,23 +122,25 @@ class TestRiskLevelCalculationFragmentCWAViewModel @AssistedInject constructor(
riskLevel = latestCalc.riskState, riskLevel = latestCalc.riskState,
riskLevelLastSuccessfulCalculated = latestSuccessfulCalc.riskState, riskLevelLastSuccessfulCalculated = latestSuccessfulCalc.riskState,
matchedKeyCount = latestCalc.matchedKeyCount, matchedKeyCount = latestCalc.matchedKeyCount,
daysSinceLastExposure = latestCalc.daysWithEncounters, noOfDaysWithExposures = if (latestCalc.riskState == RiskState.INCREASED_RISK)
latestCalc.ewAggregatedRiskResult?.numberOfDaysWithHighRisk ?: 0
else latestCalc.ewAggregatedRiskResult?.numberOfDaysWithLowRisk ?: 0,
lastKeySubmission = latestSubmission?.startedAt lastKeySubmission = latestSubmission?.startedAt
) )
}.asLiveData() }.asLiveData()
private suspend fun createAdditionalRiskCalcInfo( private fun createAdditionalRiskCalcInfo(
lastTimeRiskLevelCalculation: Instant, lastTimeRiskLevelCalculation: Instant,
riskLevel: RiskState, riskLevel: RiskState,
riskLevelLastSuccessfulCalculated: RiskState, riskLevelLastSuccessfulCalculated: RiskState,
matchedKeyCount: Int, matchedKeyCount: Int,
daysSinceLastExposure: Int, noOfDaysWithExposures: Int,
lastKeySubmission: Instant? lastKeySubmission: Instant?
): String = StringBuilder() ): String = StringBuilder()
.appendLine("Risk Level: $riskLevel") .appendLine("Risk Level: $riskLevel")
.appendLine("Last successful Risk Level: $riskLevelLastSuccessfulCalculated") .appendLine("Last successful Risk Level: $riskLevelLastSuccessfulCalculated")
.appendLine("Matched key count: $matchedKeyCount") .appendLine("Matched key count: $matchedKeyCount")
.appendLine("Days since last Exposure: $daysSinceLastExposure days") .appendLine("Days with exposures: $noOfDaysWithExposures days")
.appendLine("Last key submission: $lastKeySubmission") .appendLine("Last key submission: $lastKeySubmission")
.appendLine("Last time risk level calculation $lastTimeRiskLevelCalculation") .appendLine("Last time risk level calculation $lastTimeRiskLevelCalculation")
.toString() .toString()
......
...@@ -21,12 +21,16 @@ data class PtRiskLevelResult( ...@@ -21,12 +21,16 @@ data class PtRiskLevelResult(
riskState != RiskState.CALCULATION_FAILED riskState != RiskState.CALCULATION_FAILED
} }
val numberOfDaysWithHighRisk: Int by lazy { val daysWithHighRisk: List<LocalDate> by lazy {
presenceTracingDayRisk?.count { it.riskState == RiskState.INCREASED_RISK } ?: 0 presenceTracingDayRisk?.filter {
it.riskState == RiskState.INCREASED_RISK
}?.map { it.localDateUtc } ?: emptyList()
} }
val numberOfDaysWithLowRisk: Int by lazy { val daysWithLowRisk: List<LocalDate> by lazy {
presenceTracingDayRisk?.count { it.riskState == RiskState.LOW_RISK } ?: 0 presenceTracingDayRisk?.filter {
it.riskState == RiskState.LOW_RISK
}?.map { it.localDateUtc } ?: emptyList()
} }
val mostRecentDateWithHighRisk: LocalDate? by lazy { val mostRecentDateWithHighRisk: LocalDate? by lazy {
......
...@@ -31,12 +31,14 @@ data class CombinedEwPtRiskLevelResult( ...@@ -31,12 +31,14 @@ data class CombinedEwPtRiskLevelResult(
val daysWithEncounters: Int by lazy { val daysWithEncounters: Int by lazy {
when (riskState) { when (riskState) {
RiskState.INCREASED_RISK -> { RiskState.INCREASED_RISK -> {
(ewRiskLevelResult.ewAggregatedRiskResult?.numberOfDaysWithHighRisk ?: 0) + ewRiskLevelResult.daysWithHighRisk
ptRiskLevelResult.numberOfDaysWithHighRisk .plus(ptRiskLevelResult.daysWithHighRisk)
.distinct().count()
} }
RiskState.LOW_RISK -> { RiskState.LOW_RISK -> {
(ewRiskLevelResult.ewAggregatedRiskResult?.numberOfDaysWithLowRisk ?: 0) + ewRiskLevelResult.daysWithLowRisk
ptRiskLevelResult.numberOfDaysWithLowRisk .plus(ptRiskLevelResult.daysWithLowRisk)
.distinct().count()
} }
else -> 0 else -> 0
} }
......
...@@ -3,6 +3,7 @@ package de.rki.coronawarnapp.risk ...@@ -3,6 +3,7 @@ package de.rki.coronawarnapp.risk
import com.google.android.gms.nearby.exposurenotification.ExposureWindow import com.google.android.gms.nearby.exposurenotification.ExposureWindow
import de.rki.coronawarnapp.risk.result.EwAggregatedRiskResult import de.rki.coronawarnapp.risk.result.EwAggregatedRiskResult
import org.joda.time.Instant import org.joda.time.Instant
import org.joda.time.LocalDate
interface EwRiskLevelResult { interface EwRiskLevelResult {
val calculatedAt: Instant val calculatedAt: Instant
...@@ -35,13 +36,6 @@ interface EwRiskLevelResult { ...@@ -35,13 +36,6 @@ interface EwRiskLevelResult {
ewAggregatedRiskResult?.totalMinimumDistinctEncountersWithLowRisk ?: 0 ewAggregatedRiskResult?.totalMinimumDistinctEncountersWithLowRisk ?: 0
} }
val daysWithEncounters: Int
get() = if (isIncreasedRisk) {
ewAggregatedRiskResult?.numberOfDaysWithHighRisk ?: 0
} else {
ewAggregatedRiskResult?.numberOfDaysWithLowRisk ?: 0
}
val lastRiskEncounterAt: Instant? val lastRiskEncounterAt: Instant?
get() = if (isIncreasedRisk) { get() = if (isIncreasedRisk) {
ewAggregatedRiskResult?.mostRecentDateWithHighRisk ewAggregatedRiskResult?.mostRecentDateWithHighRisk
...@@ -49,6 +43,16 @@ interface EwRiskLevelResult { ...@@ -49,6 +43,16 @@ interface EwRiskLevelResult {
ewAggregatedRiskResult?.mostRecentDateWithLowRisk ewAggregatedRiskResult?.mostRecentDateWithLowRisk
} }
val daysWithHighRisk: List<LocalDate>
get() = ewAggregatedRiskResult?.exposureWindowDayRisks?.filter {
it.riskLevel.mapToRiskState() == RiskState.INCREASED_RISK
}?.map { it.localDateUtc } ?: emptyList()
val daysWithLowRisk: List<LocalDate>
get() = ewAggregatedRiskResult?.exposureWindowDayRisks?.filter {
it.riskLevel.mapToRiskState() == RiskState.LOW_RISK
}?.map { it.localDateUtc } ?: emptyList()
enum class FailureReason(val failureCode: String) { enum class FailureReason(val failureCode: String) {
UNKNOWN("unknown"), UNKNOWN("unknown"),
TRACING_OFF("tracingOff"), TRACING_OFF("tracingOff"),
......
...@@ -30,7 +30,6 @@ private object EwInitialLowRiskLevelResult : EwRiskLevelResult { ...@@ -30,7 +30,6 @@ private object EwInitialLowRiskLevelResult : EwRiskLevelResult {
override val ewAggregatedRiskResult: EwAggregatedRiskResult? = null override val ewAggregatedRiskResult: EwAggregatedRiskResult? = null
override val exposureWindows: List<ExposureWindow>? = null override val exposureWindows: List<ExposureWindow>? = null
override val matchedKeyCount: Int = 0 override val matchedKeyCount: Int = 0
override val daysWithEncounters: Int = 0
} }
private object EwUndeterminedRiskLevelResult : EwRiskLevelResult { private object EwUndeterminedRiskLevelResult : EwRiskLevelResult {
...@@ -40,5 +39,4 @@ private object EwUndeterminedRiskLevelResult : EwRiskLevelResult { ...@@ -40,5 +39,4 @@ private object EwUndeterminedRiskLevelResult : EwRiskLevelResult {
override val ewAggregatedRiskResult: EwAggregatedRiskResult? = null override val ewAggregatedRiskResult: EwAggregatedRiskResult? = null
override val exposureWindows: List<ExposureWindow>? = null override val exposureWindows: List<ExposureWindow>? = null
override val matchedKeyCount: Int = 0 override val matchedKeyCount: Int = 0
override val daysWithEncounters: Int = 0
} }
...@@ -190,7 +190,8 @@ abstract class BaseRiskLevelStorage constructor( ...@@ -190,7 +190,8 @@ abstract class BaseRiskLevelStorage constructor(
presenceTracingRiskRepository.allEntries() presenceTracingRiskRepository.allEntries()
) { ewRiskLevelResults, ptRiskLevelResults -> ) { ewRiskLevelResults, ptRiskLevelResults ->
val combinedResults = riskCombinator.combineEwPtRiskLevelResults(ptRiskLevelResults, ewRiskLevelResults) val combinedResults = riskCombinator
.combineEwPtRiskLevelResults(ptRiskLevelResults, ewRiskLevelResults)
.sortedByDescending { it.calculatedAt } .sortedByDescending { it.calculatedAt }
LastCombinedRiskResults( LastCombinedRiskResults(
......
...@@ -27,7 +27,6 @@ class RiskCombinator @Inject constructor( ...@@ -27,7 +27,6 @@ class RiskCombinator @Inject constructor(
override val ewAggregatedRiskResult: EwAggregatedRiskResult? = null override val ewAggregatedRiskResult: EwAggregatedRiskResult? = null
override val exposureWindows: List<ExposureWindow>? = null override val exposureWindows: List<ExposureWindow>? = null
override val matchedKeyCount: Int = 0 override val matchedKeyCount: Int = 0
override val daysWithEncounters: Int = 0
} }
private val initialPTRiskLevelResult: PtRiskLevelResult = PtRiskLevelResult( private val initialPTRiskLevelResult: PtRiskLevelResult = PtRiskLevelResult(
...@@ -48,7 +47,6 @@ class RiskCombinator @Inject constructor( ...@@ -48,7 +47,6 @@ class RiskCombinator @Inject constructor(
override val ewAggregatedRiskResult: EwAggregatedRiskResult? = null override val ewAggregatedRiskResult: EwAggregatedRiskResult? = null
override val exposureWindows: List<ExposureWindow>? = null override val exposureWindows: List<ExposureWindow>? = null
override val matchedKeyCount: Int = 0 override val matchedKeyCount: Int = 0
override val daysWithEncounters: Int = 0
} }
private val ptCurrentLowRiskLevelResult: PtRiskLevelResult private val ptCurrentLowRiskLevelResult: PtRiskLevelResult
......
...@@ -50,7 +50,6 @@ class ExposureRiskMetadataDonorTest : BaseTest() { ...@@ -50,7 +50,6 @@ class ExposureRiskMetadataDonorTest : BaseTest() {
override val failureReason: EwRiskLevelResult.FailureReason? = failureReason override val failureReason: EwRiskLevelResult.FailureReason? = failureReason
override val exposureWindows: List<ExposureWindow>? = null override val exposureWindows: List<ExposureWindow>? = null
override val matchedKeyCount: Int = 0 override val matchedKeyCount: Int = 0
override val daysWithEncounters: Int = 0
} }
private fun createInstance() = ExposureRiskMetadataDonor( private fun createInstance() = ExposureRiskMetadataDonor(
......
package de.rki.coronawarnapp.risk
import com.google.android.gms.nearby.exposurenotification.ExposureWindow
import de.rki.coronawarnapp.presencetracing.risk.PtRiskLevelResult
import de.rki.coronawarnapp.presencetracing.risk.calculation.PresenceTracingDayRisk
import de.rki.coronawarnapp.risk.result.EwAggregatedRiskResult
import de.rki.coronawarnapp.risk.result.ExposureWindowDayRisk
import de.rki.coronawarnapp.server.protocols.internal.v2.RiskCalculationParametersOuterClass
import de.rki.coronawarnapp.util.TimeAndDateExtensions.toLocalDateUtc
import io.kotest.matchers.shouldBe
import io.mockk.MockKAnnotations
import io.mockk.every
import io.mockk.impl.annotations.MockK
import org.joda.time.Instant
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import testhelpers.BaseTest
class CombinedEwPtRiskTest : BaseTest() {
@MockK lateinit var ewAggregatedRiskResult: EwAggregatedRiskResult
@BeforeEach
fun setup() {
MockKAnnotations.init(this)
}
@Test
fun `counts high risk days correctly`() {
val ewDayRisk = ExposureWindowDayRisk(
dateMillisSinceEpoch = 1000,
riskLevel = RiskCalculationParametersOuterClass.NormalizedTimeToRiskLevelMapping.RiskLevel.HIGH,
minimumDistinctEncountersWithLowRisk = 0,
minimumDistinctEncountersWithHighRisk = 1
)
val ewDayRisk2 = ExposureWindowDayRisk(
dateMillisSinceEpoch = 1000 + MILLIS_DAY,
riskLevel = RiskCalculationParametersOuterClass.NormalizedTimeToRiskLevelMapping.RiskLevel.LOW,
minimumDistinctEncountersWithLowRisk = 1,
minimumDistinctEncountersWithHighRisk = 0
)
val ewDayRisk3 = ExposureWindowDayRisk(
dateMillisSinceEpoch = 1000 + 2 * MILLIS_DAY,
riskLevel = RiskCalculationParametersOuterClass.NormalizedTimeToRiskLevelMapping.RiskLevel.HIGH,
minimumDistinctEncountersWithLowRisk = 1,
minimumDistinctEncountersWithHighRisk = 2
)
every { ewAggregatedRiskResult.exposureWindowDayRisks } returns listOf(ewDayRisk, ewDayRisk2, ewDayRisk3)
val ptDayRisk = PresenceTracingDayRisk(
riskState = RiskState.INCREASED_RISK,
localDateUtc = Instant.ofEpochMilli(1000).toLocalDateUtc()
)
val ptDayRisk2 = PresenceTracingDayRisk(
riskState = RiskState.LOW_RISK,
localDateUtc = Instant.ofEpochMilli(1000 + MILLIS_DAY).toLocalDateUtc()
)
val ptDayRisk3 = PresenceTracingDayRisk(
riskState = RiskState.INCREASED_RISK,
localDateUtc = Instant.ofEpochMilli(1000 + 2 * MILLIS_DAY).toLocalDateUtc()
)
every { ewAggregatedRiskResult.isIncreasedRisk() } returns true
CombinedEwPtRiskLevelResult(
ptRiskLevelResult = createPtRiskLevelResult(
calculatedAt = Instant.ofEpochMilli(1000 + 2 * MILLIS_DAY),
riskState = RiskState.LOW_RISK,
presenceTracingDayRisk = listOf(ptDayRisk, ptDayRisk2, ptDayRisk3)
),
ewRiskLevelResult = createEwRiskLevel(
calculatedAt = Instant.ofEpochMilli(1000 + 2 * MILLIS_DAY),
ewAggregatedRiskResult
)
).daysWithEncounters shouldBe 2
}
@Test
fun `counts low risk days correctly`() {
val ewDayRisk = ExposureWindowDayRisk(
dateMillisSinceEpoch = 1000,
riskLevel = RiskCalculationParametersOuterClass.NormalizedTimeToRiskLevelMapping.RiskLevel.LOW,
minimumDistinctEncountersWithLowRisk = 0,
minimumDistinctEncountersWithHighRisk = 1
)
val ewDayRisk2 = ExposureWindowDayRisk(
dateMillisSinceEpoch = 1000 + MILLIS_DAY,
riskLevel = RiskCalculationParametersOuterClass.NormalizedTimeToRiskLevelMapping.RiskLevel.LOW,
minimumDistinctEncountersWithLowRisk = 1,
minimumDistinctEncountersWithHighRisk = 0
)
every { ewAggregatedRiskResult.exposureWindowDayRisks } returns listOf(ewDayRisk, ewDayRisk2)
val ptDayRisk = PresenceTracingDayRisk(
riskState = RiskState.LOW_RISK,
localDateUtc = Instant.ofEpochMilli(1000).toLocalDateUtc()
)
val ptDayRisk3 = PresenceTracingDayRisk(
riskState = RiskState.LOW_RISK,
localDateUtc = Instant.ofEpochMilli(1000 + 2 * MILLIS_DAY).toLocalDateUtc()
)
every { ewAggregatedRiskResult.isLowRisk() } returns true
every { ewAggregatedRiskResult.isIncreasedRisk() } returns false
CombinedEwPtRiskLevelResult(
ptRiskLevelResult = createPtRiskLevelResult(
calculatedAt = Instant.ofEpochMilli(1000 + 2 * MILLIS_DAY),
riskState = RiskState.LOW_RISK,
presenceTracingDayRisk = listOf(ptDayRisk, ptDayRisk3)
),
ewRiskLevelResult = createEwRiskLevel(
calculatedAt = Instant.ofEpochMilli(1000 + 2 * MILLIS_DAY),
ewAggregatedRiskResult
)
).daysWithEncounters shouldBe 3
}
private fun createPtRiskLevelResult(
calculatedAt: Instant,
riskState: RiskState,
presenceTracingDayRisk: List<PresenceTracingDayRisk>
): PtRiskLevelResult = PtRiskLevelResult(
calculatedAt = calculatedAt,
riskState = riskState,
presenceTracingDayRisk = presenceTracingDayRisk
)
private fun createEwRiskLevel(
calculatedAt: Instant,
ewAggregatedRiskResult: EwAggregatedRiskResult?
): EwRiskLevelResult = object : EwRiskLevelResult {
override val calculatedAt = calculatedAt
override val ewAggregatedRiskResult: EwAggregatedRiskResult? = ewAggregatedRiskResult
override val failureReason: EwRiskLevelResult.FailureReason? = null
override val exposureWindows: List<ExposureWindow>? = null
override val matchedKeyCount: Int = 0
}
}
private const val MILLIS_DAY = (1000 * 60 * 60 * 24).toLong()
...@@ -21,7 +21,6 @@ class EwRiskLevelResultExtensionsTest : BaseTest() { ...@@ -21,7 +21,6 @@ class EwRiskLevelResultExtensionsTest : BaseTest() {
get() = if (!hasResult) EwRiskLevelResult.FailureReason.UNKNOWN else null get() = if (!hasResult) EwRiskLevelResult.FailureReason.UNKNOWN else null
override val exposureWindows: List<ExposureWindow>? = null override val exposureWindows: List<ExposureWindow>? = null
override val matchedKeyCount: Int = 0 override val matchedKeyCount: Int = 0
override val daysWithEncounters: Int = 0
} }
@Test @Test
......
...@@ -2,28 +2,29 @@ package de.rki.coronawarnapp.risk ...@@ -2,28 +2,29 @@ package de.rki.coronawarnapp.risk
import com.google.android.gms.nearby.exposurenotification.ExposureWindow import com.google.android.gms.nearby.exposurenotification.ExposureWindow
import de.rki.coronawarnapp.risk.result.EwAggregatedRiskResult import de.rki.coronawarnapp.risk.result.EwAggregatedRiskResult
import de.rki.coronawarnapp.risk.result.ExposureWindowDayRisk
import de.rki.coronawarnapp.server.protocols.internal.v2.RiskCalculationParametersOuterClass.NormalizedTimeToRiskLevelMapping.RiskLevel
import io.kotest.matchers.shouldBe import io.kotest.matchers.shouldBe
import io.mockk.MockKAnnotations
import io.mockk.every
import io.mockk.impl.annotations.MockK
import io.mockk.mockk import io.mockk.mockk
import org.joda.time.Instant import org.joda.time.Instant
import org.junit.Test import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import testhelpers.BaseTest import testhelpers.BaseTest
class EwRiskLevelResultTest : BaseTest() { class EwRiskLevelResultTest : BaseTest() {
private fun createRiskLevel( @MockK lateinit var ewAggregatedRiskResult1: EwAggregatedRiskResult
ewAggregatedRiskResult: EwAggregatedRiskResult?,
failureReason: EwRiskLevelResult.FailureReason? @BeforeEach
): EwRiskLevelResult = object : EwRiskLevelResult { fun setup() {
override val calculatedAt: Instant = Instant.EPOCH MockKAnnotations.init(this)
override val ewAggregatedRiskResult: EwAggregatedRiskResult? = ewAggregatedRiskResult
override val failureReason: EwRiskLevelResult.FailureReason? = failureReason
override val exposureWindows: List<ExposureWindow>? = null
override val matchedKeyCount: Int = 0
override val daysWithEncounters: Int = 0
} }
@Test @Test
fun testUnsuccessfulRistLevels() { fun testUnsuccessfulRiskLevels() {
createRiskLevel( createRiskLevel(
ewAggregatedRiskResult = null, ewAggregatedRiskResult = null,
failureReason = EwRiskLevelResult.FailureReason.UNKNOWN failureReason = EwRiskLevelResult.FailureReason.UNKNOWN
...@@ -34,4 +35,46 @@ class EwRiskLevelResultTest : BaseTest() { ...@@ -34,4 +35,46 @@ class EwRiskLevelResultTest : BaseTest() {
failureReason = null failureReason = null
).wasSuccessfullyCalculated shouldBe true ).wasSuccessfullyCalculated shouldBe true
} }
@Test
fun `counts days correctly`() {
val dayRisk = ExposureWindowDayRisk(
dateMillisSinceEpoch = 1000,
riskLevel = RiskLevel.HIGH,
minimumDistinctEncountersWithLowRisk = 0,
minimumDistinctEncountersWithHighRisk = 1
)
val dayRisk2 = ExposureWindowDayRisk(
dateMillisSinceEpoch = 1000 + MILLIS_DAY,
riskLevel = RiskLevel.LOW,
minimumDistinctEncountersWithLowRisk = 1,
minimumDistinctEncountersWithHighRisk = 0
)
val dayRisk3 = ExposureWindowDayRisk(
dateMillisSinceEpoch = 1000 + 2 * MILLIS_DAY,
riskLevel = RiskLevel.HIGH,
minimumDistinctEncountersWithLowRisk = 1,
minimumDistinctEncountersWithHighRisk = 2
)
every { ewAggregatedRiskResult1.exposureWindowDayRisks } returns listOf(dayRisk, dayRisk2, dayRisk3)
val riskLevel = createRiskLevel(
ewAggregatedRiskResult = ewAggregatedRiskResult1,
failureReason = null
)
riskLevel.daysWithHighRisk.size shouldBe 2
riskLevel.daysWithLowRisk.size shouldBe 1
}
private fun createRiskLevel(
ewAggregatedRiskResult: EwAggregatedRiskResult?,
failureReason: EwRiskLevelResult.FailureReason?
): EwRiskLevelResult = object : EwRiskLevelResult {
override val calculatedAt: Instant = Instant.EPOCH
override val ewAggregatedRiskResult: EwAggregatedRiskResult? = ewAggregatedRiskResult
override val failureReason: EwRiskLevelResult.FailureReason? = failureReason
override val exposureWindows: List<ExposureWindow>? = null
override val matchedKeyCount: Int = 0
}
} }
private const val MILLIS_DAY = (1000 * 60 * 60 * 24).toLong()
...@@ -105,7 +105,6 @@ class RiskLevelChangeDetectorTest : BaseTest() { ...@@ -105,7 +105,6 @@ class RiskLevelChangeDetectorTest : BaseTest() {
override val failureReason: EwRiskLevelResult.FailureReason? = null override val failureReason: EwRiskLevelResult.FailureReason? = null
override val exposureWindows: List<ExposureWindow>? = null override val exposureWindows: List<ExposureWindow>? = null
override val matchedKeyCount: Int = 0 override val matchedKeyCount: Int = 0
override val daysWithEncounters: Int = 0
} }
private fun createPtRiskLevel( private fun createPtRiskLevel(
......
...@@ -210,7 +210,7 @@ class RiskCombinatorTest : BaseTest() { ...@@ -210,7 +210,7 @@ class RiskCombinatorTest : BaseTest() {
} }
@Test @Test
fun `max RiskState works`() { fun `combine RiskState works`() {
RiskCombinator.combine(INCREASED_RISK, INCREASED_RISK) shouldBe INCREASED_RISK RiskCombinator.combine(INCREASED_RISK, INCREASED_RISK) shouldBe INCREASED_RISK
RiskCombinator.combine(INCREASED_RISK, LOW_RISK) shouldBe INCREASED_RISK RiskCombinator.combine(INCREASED_RISK, LOW_RISK) shouldBe INCREASED_RISK
RiskCombinator.combine(INCREASED_RISK, CALCULATION_FAILED) shouldBe CALCULATION_FAILED RiskCombinator.combine(INCREASED_RISK, CALCULATION_FAILED) shouldBe CALCULATION_FAILED
...@@ -232,5 +232,4 @@ private fun createEwRiskLevelResult( ...@@ -232,5 +232,4 @@ private fun createEwRiskLevelResult(
override val ewAggregatedRiskResult: EwAggregatedRiskResult? = null override val ewAggregatedRiskResult: EwAggregatedRiskResult? = null
override val exposureWindows: List<ExposureWindow>? = null override val exposureWindows: List<ExposureWindow>? = null
override val matchedKeyCount: Int = 0 override val matchedKeyCount: Int = 0
override val daysWithEncounters: Int = 0
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment