TriggerConnector extends Trigger { @Override public synchronized String toJSON() { JSONObject o = new JSONObject(); try { o.put("type", TriggerConnector.class.getName()); JSONObject data = new JSONObject(); data.put("connectorType", connectorType.toString()); JSONArray array = new JSONArray(); for (Trigger t : list) { array.put(t.toJSON()); } data.put("triggerList", array); o.put("data", data); } catch (JSONException e) { log.error("Unhandled exception", e); } return o.toString(); } TriggerConnector();  TriggerConnector(Type connectorType); static void fillIconSet(TriggerConnector connector, HashSet<Integer> set); void changeConnectorType(Type type); Type getConnectorType(); synchronized void add(Trigger t); synchronized void add(int pos, Trigger t); synchronized boolean remove(Trigger t); int size(); Trigger get(int i); int pos(Trigger trigger); @Override synchronized boolean shouldRun(); @Override synchronized String toJSON(); @Override int friendlyName(); @Override String friendlyDescription(); @Override Optional<Integer> icon(); @Override void executed(long time); @Override Trigger duplicate(); void rebuildView(FragmentManager fragmentManager); @Override void generateDialog(LinearLayout root, FragmentManager fragmentManager); TriggerConnector simplify();  }
@Test public void toJSONTest() { TriggerConnector t = new TriggerConnector(); Assert.assertEquals(empty, t.toJSON()); t.add(new TriggerConnector()); Assert.assertEquals(oneItem, t.toJSON()); }