parent
369c876d49
commit
16d0f562c7
1 changed files with 5 additions and 5 deletions
|
@ -1,9 +1,9 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message
|
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message
|
||||||
|
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import com.google.crypto.tink.subtle.Hex
|
import com.google.crypto.tink.subtle.Hex
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.packet.PayloadSplitter
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.packet.PayloadSplitter
|
||||||
import info.nightscout.core.utils.toHex
|
import info.nightscout.core.utils.toHex
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class PayloadSplitterTest {
|
class PayloadSplitterTest {
|
||||||
|
@ -16,10 +16,10 @@ class PayloadSplitterTest {
|
||||||
val splitter = PayloadSplitter(payload)
|
val splitter = PayloadSplitter(payload)
|
||||||
val packets = splitter.splitInPackets()
|
val packets = splitter.splitInPackets()
|
||||||
|
|
||||||
Assertions.assertEquals(packets.size, 2)
|
assertThat(packets).hasSize(2)
|
||||||
Assertions.assertEquals(f1, packets[0].toByteArray().toHex())
|
assertThat(packets[0].toByteArray().toHex()).isEqualTo(f1)
|
||||||
val p2 = packets[1].toByteArray()
|
val p2 = packets[1].toByteArray()
|
||||||
Assertions.assertTrue(p2.size >= 10)
|
assertThat(p2.size).isAtLeast(10)
|
||||||
Assertions.assertEquals(f2.subSequence(0, 20), p2.copyOfRange(0, 10).toHex())
|
assertThat(p2.copyOfRange(0, 10).toHex()).isEqualTo(f2.subSequence(0, 20))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue