parent
6785f1a11d
commit
25112828a2
1 changed files with 10 additions and 10 deletions
|
@ -1,26 +1,26 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response
|
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response
|
||||||
|
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlarmType
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlarmType
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.NakErrorType
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.NakErrorType
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodStatus
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodStatus
|
||||||
import org.apache.commons.codec.DecoderException
|
import org.apache.commons.codec.DecoderException
|
||||||
import org.apache.commons.codec.binary.Hex
|
import org.apache.commons.codec.binary.Hex
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class NakResponseTest {
|
class NakResponseTest {
|
||||||
|
|
||||||
@Test @Throws(DecoderException::class) fun testValidResponse() {
|
@Test fun testValidResponse() {
|
||||||
val encoded = Hex.decodeHex("0603070009")
|
val encoded = Hex.decodeHex("0603070009")
|
||||||
val response = NakResponse(encoded)
|
val response = NakResponse(encoded)
|
||||||
|
|
||||||
Assertions.assertArrayEquals(encoded, response.encoded)
|
assertThat(response.encoded).asList().containsExactlyElementsIn(encoded.asList()).inOrder()
|
||||||
Assertions.assertNotSame(encoded, response.encoded)
|
assertThat(response.encoded).isNotSameInstanceAs(encoded)
|
||||||
Assertions.assertEquals(ResponseType.NAK_RESPONSE, response.responseType)
|
assertThat(response.responseType).isEqualTo(ResponseType.NAK_RESPONSE)
|
||||||
Assertions.assertEquals(ResponseType.NAK_RESPONSE.value, response.messageType)
|
assertThat(response.messageType).isEqualTo(ResponseType.NAK_RESPONSE.value)
|
||||||
Assertions.assertEquals(NakErrorType.ILLEGAL_PARAM, response.nakErrorType)
|
assertThat(response.nakErrorType).isEqualTo(NakErrorType.ILLEGAL_PARAM)
|
||||||
Assertions.assertEquals(AlarmType.NONE, response.alarmType)
|
assertThat(response.alarmType).isEqualTo(AlarmType.NONE)
|
||||||
Assertions.assertEquals(PodStatus.RUNNING_BELOW_MIN_VOLUME, response.podStatus)
|
assertThat(response.podStatus).isEqualTo(PodStatus.RUNNING_BELOW_MIN_VOLUME)
|
||||||
Assertions.assertEquals(0x00.toShort(), response.securityNakSyncCount)
|
assertThat(response.securityNakSyncCount).isEqualTo(0x00.toShort())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue