NonOverlapingIntervalsTest 2nd

This commit is contained in:
Milos Kozak 2018-03-26 22:55:38 +02:00
parent cc436a09d9
commit f8c9fac7b1
2 changed files with 16 additions and 7 deletions

View file

@ -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);

View file

@ -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());
}
}