Fix tests
This commit is contained in:
parent
04574d759f
commit
75d0bd9761
5 changed files with 33 additions and 8 deletions
|
@ -58,6 +58,18 @@ public class TriggerBg extends Trigger {
|
|||
threshold = triggerBg.threshold;
|
||||
}
|
||||
|
||||
public double getThreshold() {
|
||||
return threshold;
|
||||
}
|
||||
|
||||
public Comparator getComparator() {
|
||||
return comparator;
|
||||
}
|
||||
|
||||
public String getUnits() {
|
||||
return units;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean shouldRun() {
|
||||
GlucoseStatus glucoseStatus = GlucoseStatus.getGlucoseStatusData();
|
||||
|
|
|
@ -132,6 +132,18 @@ public class TriggerTime extends Trigger {
|
|||
return weekdays[day.ordinal()];
|
||||
}
|
||||
|
||||
public long getLastRun() {
|
||||
return lastRun;
|
||||
}
|
||||
|
||||
public long getRunAt() {
|
||||
return runAt;
|
||||
}
|
||||
|
||||
public boolean isRecurring() {
|
||||
return recurring;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRun() {
|
||||
if (recurring) {
|
||||
|
|
|
@ -17,9 +17,7 @@ public class DummyTrigger extends Trigger {
|
|||
}
|
||||
|
||||
@Override
|
||||
String toJSON() {
|
||||
return null;
|
||||
}
|
||||
public String toJSON() { return null; }
|
||||
|
||||
@Override
|
||||
Trigger fromJSON(String data) {
|
||||
|
@ -35,4 +33,7 @@ public class DummyTrigger extends Trigger {
|
|||
public String friendlyDescription() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Trigger duplicate() { return new DummyTrigger(result); }
|
||||
}
|
||||
|
|
|
@ -75,9 +75,9 @@ public class TriggerBgTest {
|
|||
TriggerBg t = new TriggerBg().units(Constants.MMOL).threshold(4.1d).comparator(Trigger.Comparator.IS_EQUAL);
|
||||
|
||||
TriggerBg t2 = (TriggerBg) Trigger.instantiate(new JSONObject(t.toJSON()));
|
||||
Assert.assertEquals(Trigger.Comparator.IS_EQUAL, t2.comparator);
|
||||
Assert.assertEquals(4.1d, t2.threshold, 0.01d);
|
||||
Assert.assertEquals(Constants.MMOL, t2.units);
|
||||
Assert.assertEquals(Trigger.Comparator.IS_EQUAL, t2.getComparator());
|
||||
Assert.assertEquals(4.1d, t2.getThreshold(), 0.01d);
|
||||
Assert.assertEquals(Constants.MMOL, t2.getUnits());
|
||||
}
|
||||
|
||||
@Before
|
||||
|
|
|
@ -70,8 +70,8 @@ public class TriggerTimeTest {
|
|||
TriggerTime t = new TriggerTime().runAt(now - T.mins(1).msecs());
|
||||
|
||||
TriggerTime t2 = (TriggerTime) Trigger.instantiate(new JSONObject(t.toJSON()));
|
||||
Assert.assertEquals(now - T.mins(1).msecs(), t2.runAt);
|
||||
Assert.assertEquals(false, t2.recurring);
|
||||
Assert.assertEquals(now - T.mins(1).msecs(), t2.getRunAt());
|
||||
Assert.assertEquals(false, t2.isRecurring());
|
||||
}
|
||||
|
||||
@Before
|
||||
|
|
Loading…
Reference in a new issue