TriggerTime extends Trigger { @Override Trigger fromJSON(String data) { JSONObject o; try { o = new JSONObject(data); lastRun = JsonHelper.safeGetLong(o, "lastRun"); runAt = JsonHelper.safeGetLong(o, "runAt"); } catch (JSONException e) { log.error("Unhandled exception", e); } return this; } TriggerTime(); private  TriggerTime(TriggerTime triggerTime); @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 fromJSONTest() throws JSONException { 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.getRunAt()); }