NonOverlapingIntervalsTest 2nd
This commit is contained in:
parent
cc436a09d9
commit
f8c9fac7b1
2 changed files with 16 additions and 7 deletions
|
@ -894,13 +894,13 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
try {
|
||||
String units = MainApp.getConfigBuilder().getProfileUnits();
|
||||
TempTarget tempTarget = new TempTarget()
|
||||
.date(trJson.getLong("mills"))
|
||||
.duration(trJson.getInt("duration"))
|
||||
.low(Profile.toMgdl(trJson.getDouble("targetBottom"), units))
|
||||
.high(Profile.toMgdl(trJson.getDouble("targetTop"), units))
|
||||
.reason(trJson.getString("reason"))
|
||||
._id(trJson.getString("_id"))
|
||||
.source(Source.NIGHTSCOUT);
|
||||
.date(trJson.getLong("mills"))
|
||||
.duration(trJson.getInt("duration"))
|
||||
.low(Profile.toMgdl(trJson.getDouble("targetBottom"), units))
|
||||
.high(Profile.toMgdl(trJson.getDouble("targetTop"), units))
|
||||
.reason(trJson.getString("reason"))
|
||||
._id(trJson.getString("_id"))
|
||||
.source(Source.NIGHTSCOUT);
|
||||
createOrUpdate(tempTarget);
|
||||
} catch (JSONException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
|
|
|
@ -46,4 +46,13 @@ public class NonOverapingIntervalsTest {
|
|||
Assert.assertEquals(null, list.getValueByInterval(startDate + T.hours(10).msecs() + 1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCopyConstructor() {
|
||||
list.reset();
|
||||
list.add(new TemporaryBasal().date(startDate).duration((int) T.hours(10).mins()).absolute(1));
|
||||
NonOverlappingIntervals<TemporaryBasal> list2 = new NonOverlappingIntervals<>(list);
|
||||
Assert.assertEquals(1, list2.getList().size());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue