diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBg.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBg.java index 5b0ef66e6f..5d42f55cdc 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBg.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBg.java @@ -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(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTime.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTime.java index 2dee94eadb..1abd9de4eb 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTime.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTime.java @@ -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) { diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/DummyTrigger.java b/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/DummyTrigger.java index 56ca4a7b95..087df4326e 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/DummyTrigger.java +++ b/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/DummyTrigger.java @@ -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); } } diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBgTest.java b/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBgTest.java index 7c1f8235a6..00373c0668 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBgTest.java +++ b/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBgTest.java @@ -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 diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTimeTest.java b/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTimeTest.java index 0f5205524d..375253e7bf 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTimeTest.java +++ b/app/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerTimeTest.java @@ -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