Fix failing Omnipod test cases

This commit is contained in:
Bart Sopers 2020-05-03 13:37:50 +02:00
parent 79d64dff64
commit e01ac6f6be

View file

@ -92,7 +92,7 @@ public class AapsOmnipodManagerTest {
Profile profile = mock(Profile.class); Profile profile = mock(Profile.class);
Profile.ProfileValue value = mock(Profile.ProfileValue.class); Profile.ProfileValue value = mock(Profile.ProfileValue.class);
value.timeAsSeconds = 500; value.timeAsSeconds = 1800;
value.value = 0.5D; value.value = 0.5D;
when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[]{ when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[]{
@ -144,20 +144,20 @@ public class AapsOmnipodManagerTest {
} }
@Test @Test
public void invalidProfileUnsupportedPrecision() { public void roundsToSupportedPrecision() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Unsupported basal rate precision");
Profile profile = mock(Profile.class); Profile profile = mock(Profile.class);
Profile.ProfileValue value = mock(Profile.ProfileValue.class); Profile.ProfileValue value = mock(Profile.ProfileValue.class);
value.timeAsSeconds = 500; value.timeAsSeconds = 0;
value.value = 0.04D; value.value = 0.04D;
when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[]{ when(profile.getBasalValues()).thenReturn(new Profile.ProfileValue[]{
value, value,
}); });
AapsOmnipodManager.mapProfileToBasalSchedule(profile); BasalSchedule basalSchedule = AapsOmnipodManager.mapProfileToBasalSchedule(profile);
BasalScheduleEntry basalScheduleEntry = basalSchedule.getEntries().get(0);
assertEquals(0.05D, basalScheduleEntry.getRate(), 0.000001);
} }
} }