ActionStartTempTarget extends Action { @Override public String shortDescription() { tempTarget = new TempTarget() .date(DateUtil.now()) .duration(duration.getMinutes()) .reason(reason) .source(Source.USER) .low(Profile.toMgdl(value.getValue(), value.getUnits())) .high(Profile.toMgdl(value.getValue(), value.getUnits())); return MainApp.gs(R.string.starttemptarget) + ": " + (tempTarget == null ? "null" : tempTarget.friendlyDescription(value.getUnits())); } ActionStartTempTarget(); @Override int friendlyName(); @Override String shortDescription(); @Override void doAction(Callback callback); @Override void generateDialog(LinearLayout root); @Override boolean hasDialog(); @Override String toJSON(); @Override Action fromJSON(String data); @Override Optional<Integer> icon();  }
@Test public void shortDescriptionTest() { actionStartTempTarget = new ActionStartTempTarget(); actionStartTempTarget.reason = "Test"; actionStartTempTarget.value = new InputTempTarget().setValue(100).setUnits(Constants.MGDL); actionStartTempTarget.duration = new InputDuration(30, InputDuration.TimeUnit.MINUTES); Assert.assertEquals("Start temp target: 100mg/dl@null(Test)", actionStartTempTarget.shortDescription()); }