TriggerRecurringTime extends Trigger { @Override public String toJSON() { JSONObject object = new JSONObject(); JSONObject data = new JSONObject(); try { data.put("lastRun", lastRun); for (int i = 0; i < weekdays.length; ++i) { data.put(DayOfWeek.values()[i].name(), weekdays[i]); } data.put("hour", hour); data.put("minute", minute); data.put("validTo", validTo); object.put("type", TriggerRecurringTime.class.getName()); object.put("data", data); } catch (JSONException e) { log.error("Unhandled exception", e); } return object.toString(); } TriggerRecurringTime(); private  TriggerRecurringTime(TriggerRecurringTime triggerTime); void setAll(boolean value); TriggerRecurringTime set(DayOfWeek day, boolean value); @Override boolean shouldRun(); @Override 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() throws JSONException { TriggerRecurringTime t = new TriggerRecurringTime().lastRun(now - T.mins(1).msecs()); Assert.assertEquals(timeJson, t.toJSON()); }