TriggerIob extends Trigger { @Override public synchronized String toJSON() { JSONObject o = new JSONObject(); try { o.put("type", TriggerIob.class.getName()); JSONObject data = new JSONObject(); data.put("insulin", getValue()); data.put("lastRun", lastRun); data.put("comparator", comparator.getValue().toString()); o.put("data", data); } catch (JSONException e) { log.error("Unhandled exception", e); } return o.toString(); } TriggerIob(); private  TriggerIob(TriggerIob triggerIob); double getValue(); Comparator getComparator(); @Override synchronized boolean shouldRun(); @Override synchronized String toJSON(); @Override int friendlyName(); @Override String friendlyDescription(); @Override Optional<Integer> icon(); @Override Trigger duplicate(); @Override void generateDialog(LinearLayout root, FragmentManager fragmentManager);  }
@Test public void toJSONTest() { TriggerIob t = new TriggerIob().setValue(4.1d).comparator(Comparator.Compare.IS_EQUAL); Assert.assertEquals(bgJson, t.toJSON()); }