Rewrites DataBroadcastPluginTest with matchers

Issue #2745
This commit is contained in:
Ryan Haining 2023-09-23 19:53:50 -07:00
parent 0731827b38
commit 55b90e57f2

View file

@ -2,6 +2,7 @@ package info.nightscout.plugins.sync.dataBroadcaster
import app.aaps.shared.tests.BundleMock
import app.aaps.shared.tests.TestBaseWithProfile
import com.google.common.truth.Truth.assertThat
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.database.entities.GlucoseValue
@ -20,7 +21,6 @@ import info.nightscout.interfaces.pump.PumpEnactResult
import info.nightscout.interfaces.receivers.ReceiverStatusStore
import info.nightscout.rx.events.EventOverviewBolusProgress
import org.json.JSONObject
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.ArgumentMatchers.anyLong
@ -81,37 +81,37 @@ internal class DataBroadcastPluginTest : TestBaseWithProfile() {
}
val bundle = BundleMock.mock()
sut.prepareData(event, bundle)
Assertions.assertTrue(bundle.containsKey("progressPercent"))
Assertions.assertTrue(bundle.containsKey("progressStatus"))
Assertions.assertTrue(bundle.containsKey("glucoseMgdl"))
Assertions.assertTrue(bundle.containsKey("glucoseTimeStamp"))
Assertions.assertTrue(bundle.containsKey("units"))
Assertions.assertTrue(bundle.containsKey("slopeArrow"))
Assertions.assertTrue(bundle.containsKey("deltaMgdl"))
Assertions.assertTrue(bundle.containsKey("avgDeltaMgdl"))
Assertions.assertTrue(bundle.containsKey("high"))
Assertions.assertTrue(bundle.containsKey("low"))
Assertions.assertTrue(bundle.containsKey("bolusIob"))
Assertions.assertTrue(bundle.containsKey("basalIob"))
Assertions.assertTrue(bundle.containsKey("iob"))
Assertions.assertTrue(bundle.containsKey("cob"))
Assertions.assertTrue(bundle.containsKey("futureCarbs"))
Assertions.assertTrue(bundle.containsKey("phoneBattery"))
Assertions.assertTrue(bundle.containsKey("rigBattery"))
Assertions.assertTrue(bundle.containsKey("suggestedTimeStamp"))
Assertions.assertTrue(bundle.containsKey("suggested"))
Assertions.assertTrue(bundle.containsKey("enactedTimeStamp"))
Assertions.assertTrue(bundle.containsKey("enacted"))
Assertions.assertTrue(bundle.containsKey("basalTimeStamp"))
Assertions.assertTrue(bundle.containsKey("baseBasal"))
Assertions.assertTrue(bundle.containsKey("profile"))
Assertions.assertTrue(bundle.containsKey("tempBasalStart"))
Assertions.assertTrue(bundle.containsKey("tempBasalDurationInMinutes"))
Assertions.assertTrue(bundle.containsKey("tempBasalString"))
Assertions.assertTrue(bundle.containsKey("pumpTimeStamp"))
Assertions.assertTrue(bundle.containsKey("pumpBattery"))
Assertions.assertTrue(bundle.containsKey("pumpReservoir"))
Assertions.assertTrue(bundle.containsKey("pumpStatus"))
assertThat(bundle.containsKey("progressPercent")).isTrue()
assertThat(bundle.containsKey("progressStatus")).isTrue()
assertThat(bundle.containsKey("glucoseMgdl")).isTrue()
assertThat(bundle.containsKey("glucoseTimeStamp")).isTrue()
assertThat(bundle.containsKey("units")).isTrue()
assertThat(bundle.containsKey("slopeArrow")).isTrue()
assertThat(bundle.containsKey("deltaMgdl")).isTrue()
assertThat(bundle.containsKey("avgDeltaMgdl")).isTrue()
assertThat(bundle.containsKey("high")).isTrue()
assertThat(bundle.containsKey("low")).isTrue()
assertThat(bundle.containsKey("bolusIob")).isTrue()
assertThat(bundle.containsKey("basalIob")).isTrue()
assertThat(bundle.containsKey("iob")).isTrue()
assertThat(bundle.containsKey("cob")).isTrue()
assertThat(bundle.containsKey("futureCarbs")).isTrue()
assertThat(bundle.containsKey("phoneBattery")).isTrue()
assertThat(bundle.containsKey("rigBattery")).isTrue()
assertThat(bundle.containsKey("suggestedTimeStamp")).isTrue()
assertThat(bundle.containsKey("suggested")).isTrue()
assertThat(bundle.containsKey("enactedTimeStamp")).isTrue()
assertThat(bundle.containsKey("enacted")).isTrue()
assertThat(bundle.containsKey("basalTimeStamp")).isTrue()
assertThat(bundle.containsKey("baseBasal")).isTrue()
assertThat(bundle.containsKey("profile")).isTrue()
assertThat(bundle.containsKey("tempBasalStart")).isTrue()
assertThat(bundle.containsKey("tempBasalDurationInMinutes")).isTrue()
assertThat(bundle.containsKey("tempBasalString")).isTrue()
assertThat(bundle.containsKey("pumpTimeStamp")).isTrue()
assertThat(bundle.containsKey("pumpBattery")).isTrue()
assertThat(bundle.containsKey("pumpReservoir")).isTrue()
assertThat(bundle.containsKey("pumpStatus")).isTrue()
}
@Test
@ -123,36 +123,36 @@ internal class DataBroadcastPluginTest : TestBaseWithProfile() {
}
val bundle = BundleMock.mock()
sut.prepareData(event, bundle)
Assertions.assertTrue(bundle.containsKey("progressPercent"))
Assertions.assertTrue(bundle.containsKey("progressStatus"))
Assertions.assertTrue(bundle.containsKey("glucoseMgdl"))
Assertions.assertTrue(bundle.containsKey("glucoseTimeStamp"))
Assertions.assertTrue(bundle.containsKey("units"))
Assertions.assertTrue(bundle.containsKey("slopeArrow"))
Assertions.assertTrue(bundle.containsKey("deltaMgdl"))
Assertions.assertTrue(bundle.containsKey("avgDeltaMgdl"))
Assertions.assertTrue(bundle.containsKey("high"))
Assertions.assertTrue(bundle.containsKey("low"))
Assertions.assertTrue(bundle.containsKey("bolusIob"))
Assertions.assertTrue(bundle.containsKey("basalIob"))
Assertions.assertTrue(bundle.containsKey("iob"))
Assertions.assertTrue(bundle.containsKey("cob"))
Assertions.assertTrue(bundle.containsKey("futureCarbs"))
Assertions.assertTrue(bundle.containsKey("phoneBattery"))
Assertions.assertTrue(bundle.containsKey("rigBattery"))
Assertions.assertTrue(bundle.containsKey("suggestedTimeStamp"))
Assertions.assertTrue(bundle.containsKey("suggested"))
Assertions.assertTrue(bundle.containsKey("enactedTimeStamp"))
Assertions.assertTrue(bundle.containsKey("enacted"))
Assertions.assertTrue(bundle.containsKey("basalTimeStamp"))
Assertions.assertTrue(bundle.containsKey("baseBasal"))
Assertions.assertTrue(bundle.containsKey("profile"))
Assertions.assertTrue(bundle.containsKey("tempBasalStart"))
Assertions.assertTrue(bundle.containsKey("tempBasalDurationInMinutes"))
Assertions.assertTrue(bundle.containsKey("tempBasalString"))
Assertions.assertTrue(bundle.containsKey("pumpTimeStamp"))
Assertions.assertTrue(bundle.containsKey("pumpBattery"))
Assertions.assertTrue(bundle.containsKey("pumpReservoir"))
Assertions.assertTrue(bundle.containsKey("pumpStatus"))
assertThat(bundle.containsKey("progressPercent")).isTrue()
assertThat(bundle.containsKey("progressStatus")).isTrue()
assertThat(bundle.containsKey("glucoseMgdl")).isTrue()
assertThat(bundle.containsKey("glucoseTimeStamp")).isTrue()
assertThat(bundle.containsKey("units")).isTrue()
assertThat(bundle.containsKey("slopeArrow")).isTrue()
assertThat(bundle.containsKey("deltaMgdl")).isTrue()
assertThat(bundle.containsKey("avgDeltaMgdl")).isTrue()
assertThat(bundle.containsKey("high")).isTrue()
assertThat(bundle.containsKey("low")).isTrue()
assertThat(bundle.containsKey("bolusIob")).isTrue()
assertThat(bundle.containsKey("basalIob")).isTrue()
assertThat(bundle.containsKey("iob")).isTrue()
assertThat(bundle.containsKey("cob")).isTrue()
assertThat(bundle.containsKey("futureCarbs")).isTrue()
assertThat(bundle.containsKey("phoneBattery")).isTrue()
assertThat(bundle.containsKey("rigBattery")).isTrue()
assertThat(bundle.containsKey("suggestedTimeStamp")).isTrue()
assertThat(bundle.containsKey("suggested")).isTrue()
assertThat(bundle.containsKey("enactedTimeStamp")).isTrue()
assertThat(bundle.containsKey("enacted")).isTrue()
assertThat(bundle.containsKey("basalTimeStamp")).isTrue()
assertThat(bundle.containsKey("baseBasal")).isTrue()
assertThat(bundle.containsKey("profile")).isTrue()
assertThat(bundle.containsKey("tempBasalStart")).isTrue()
assertThat(bundle.containsKey("tempBasalDurationInMinutes")).isTrue()
assertThat(bundle.containsKey("tempBasalString")).isTrue()
assertThat(bundle.containsKey("pumpTimeStamp")).isTrue()
assertThat(bundle.containsKey("pumpBattery")).isTrue()
assertThat(bundle.containsKey("pumpReservoir")).isTrue()
assertThat(bundle.containsKey("pumpStatus")).isTrue()
}
}
}