TriggerTimeRange extends Trigger { @Override TriggerTimeRange fromJSON(String data) { JSONObject o; try { o = new JSONObject(data); lastRun = JsonHelper.safeGetLong(o, "lastRun"); start = JsonHelper.safeGetInt(o, "start"); end = JsonHelper.safeGetInt(o, "end"); } catch (JSONException e) { log.error("Unhandled exception", e); } return this; } TriggerTimeRange(); private  TriggerTimeRange(TriggerTimeRange triggerTimeRange); @Override boolean shouldRun(); @Override String toJSON(); @Override int friendlyName(); @Override String friendlyDescription(); @Override Optional<Integer> icon(); @Override Trigger duplicate(); int getMinSinceMidnight(long time); @Override void generateDialog(LinearLayout root, FragmentManager fragmentManager);  }
@Test public void fromJSONTest() throws JSONException { TriggerTimeRange t = new TriggerTimeRange().period(120 , 180); TriggerTimeRange t2 = (TriggerTimeRange) Trigger.instantiate(new JSONObject(t.toJSON())); Assert.assertEquals(timeZoneOffset + now - 1, t2.period(753 , 360).getStart()); Assert.assertEquals(timeZoneOffset + 360, t2.period(753 , 360).getEnd()); }