Rewrites PodInfoFaultAndInitializationTimeTest with matchers
Issue #2745
This commit is contained in:
parent
29113520c2
commit
36ce238cc9
1 changed files with 11 additions and 11 deletions
|
@ -1,26 +1,26 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.response.podinfo;
|
package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.response.podinfo;
|
||||||
|
|
||||||
import org.joda.time.DateTime;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import org.joda.time.Duration;
|
|
||||||
import org.junit.jupiter.api.Assertions;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.FaultEventCode;
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.FaultEventCode;
|
||||||
import info.nightscout.pump.core.utils.ByteUtil;
|
import info.nightscout.pump.core.utils.ByteUtil;
|
||||||
|
import org.joda.time.DateTime;
|
||||||
|
import org.joda.time.Duration;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
class PodInfoFaultAndInitializationTimeTest {
|
class PodInfoFaultAndInitializationTimeTest {
|
||||||
@Test
|
@Test
|
||||||
void testDecoding() {
|
void testDecoding() {
|
||||||
PodInfoFaultAndInitializationTime podInfoFaultAndInitializationTime = new PodInfoFaultAndInitializationTime(ByteUtil.fromHexString("059200010000000000000000091912170e")); // From https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/PodInfoTests.swift
|
PodInfoFaultAndInitializationTime podInfoFaultAndInitializationTime = new PodInfoFaultAndInitializationTime(ByteUtil.fromHexString("059200010000000000000000091912170e")); // From https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/PodInfoTests.swift
|
||||||
|
|
||||||
Assertions.assertEquals(FaultEventCode.BAD_PUMP_REQ_2_STATE, podInfoFaultAndInitializationTime.getFaultEventCode());
|
assertThat(podInfoFaultAndInitializationTime.getFaultEventCode()).isEqualTo(FaultEventCode.BAD_PUMP_REQ_2_STATE);
|
||||||
Assertions.assertTrue(Duration.standardMinutes(1).isEqual(podInfoFaultAndInitializationTime.getTimeFaultEvent()));
|
assertThat(podInfoFaultAndInitializationTime.getTimeFaultEvent()).isEqualTo(Duration.standardMinutes(1));
|
||||||
|
|
||||||
DateTime dateTime = podInfoFaultAndInitializationTime.getInitializationTime();
|
DateTime dateTime = podInfoFaultAndInitializationTime.getInitializationTime();
|
||||||
Assertions.assertEquals(2018, dateTime.getYear());
|
assertThat(dateTime.getYear()).isEqualTo(2018);
|
||||||
Assertions.assertEquals(9, dateTime.getMonthOfYear());
|
assertThat(dateTime.getMonthOfYear()).isEqualTo(9);
|
||||||
Assertions.assertEquals(25, dateTime.getDayOfMonth());
|
assertThat(dateTime.getDayOfMonth()).isEqualTo(25);
|
||||||
Assertions.assertEquals(23, dateTime.getHourOfDay());
|
assertThat(dateTime.getHourOfDay()).isEqualTo(23);
|
||||||
Assertions.assertEquals(14, dateTime.getMinuteOfHour());
|
assertThat(dateTime.getMinuteOfHour()).isEqualTo(14);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue