InsulinOrefBasePlugin extends PluginBase implements InsulinInterface { @Override public double getDia() { double dia = getUserDefinedDia(); if (dia >= MIN_DIA) { return dia; } else { sendShortDiaNotification(dia); return MIN_DIA; } } InsulinOrefBasePlugin(); @Override double getDia(); String getNotificationPattern(); double getUserDefinedDia(); Iob iobCalcForTreatment(Treatment treatment, long time); @Override Iob iobCalcForTreatment(Treatment treatment, long time, double dia); @Override String getComment(); static double MIN_DIA; }
@Test public void testGetDia() throws Exception { assertEquals(InsulinOrefBasePlugin.MIN_DIA, this.getDia(), 0); this.dia = InsulinOrefBasePlugin.MIN_DIA + 1; assertEquals(InsulinOrefBasePlugin.MIN_DIA + 1, this.getDia(), 0); this.dia = InsulinOrefBasePlugin.MIN_DIA - 1; assertEquals(InsulinOrefBasePlugin.MIN_DIA, this.getDia(), 0); assertTrue(this.shortDiaNotificationSend); }