ActionStopTempTarget extends Action { @Override public Action fromJSON(String data) { try { JSONObject d = new JSONObject(data); reason = JsonHelper.safeGetString(d, "reason"); } catch (JSONException e) { log.error("Unhandled exception", e); } return this; } ActionStopTempTarget(); @Override int friendlyName(); @Override String shortDescription(); @Override void doAction(Callback callback); @Override boolean hasDialog(); @Override String toJSON(); @Override Action fromJSON(String data); @Override Optional<Integer> icon();  }
@Test public void fromJSONTest() { actionStopTempTarget = new ActionStopTempTarget(); actionStopTempTarget.fromJSON("{\"reason\":\"Test\"}"); Assert.assertEquals("Test", actionStopTempTarget.reason); }