parent
58dd9692de
commit
d75bf0e611
1 changed files with 5 additions and 6 deletions
|
@ -1,11 +1,11 @@
|
||||||
package info.nightscout.pump.medtrum.comm.packets
|
package info.nightscout.pump.medtrum.comm.packets
|
||||||
|
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.pump.medtrum.MedtrumTestBase
|
import info.nightscout.pump.medtrum.MedtrumTestBase
|
||||||
import info.nightscout.pump.medtrum.extension.toByteArray
|
import info.nightscout.pump.medtrum.extension.toByteArray
|
||||||
import info.nightscout.pump.medtrum.util.MedtrumTimeUtil
|
import info.nightscout.pump.medtrum.util.MedtrumTimeUtil
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class SetTimeZonePacketTest : MedtrumTestBase() {
|
class SetTimeZonePacketTest : MedtrumTestBase() {
|
||||||
|
@ -35,9 +35,8 @@ class SetTimeZonePacketTest : MedtrumTestBase() {
|
||||||
val result = packet.getRequest()
|
val result = packet.getRequest()
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
val expectedByteArray = byteArrayOf(opCode.toByte()) + offsetMinutes.toByteArray(2) + time.toByteArray(4)
|
val expected = byteArrayOf(opCode.toByte()) + offsetMinutes.toByteArray(2) + time.toByteArray(4)
|
||||||
Assertions.assertEquals(7, result.size)
|
assertThat(result).asList().containsExactlyElementsIn(expected.toList()).inOrder()
|
||||||
Assertions.assertEquals(expectedByteArray.contentToString(), result.contentToString())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenPacketWhenValuesSetThenReturnCorrectValues() {
|
@Test fun handleResponseGivenPacketWhenValuesSetThenReturnCorrectValues() {
|
||||||
|
@ -50,7 +49,7 @@ class SetTimeZonePacketTest : MedtrumTestBase() {
|
||||||
val result = packet.handleResponse(response)
|
val result = packet.handleResponse(response)
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertTrue(result)
|
assertThat(result).isTrue()
|
||||||
Assertions.assertEquals(offsetMinutes, medtrumPump.pumpTimeZoneOffset)
|
assertThat(medtrumPump.pumpTimeZoneOffset).isEqualTo(offsetMinutes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue