TransitionJsonParser { public Transition parse(JSONObject json, int id) throws JSONException { final String name = json.getString("name"); final Collection<Transition.Field> fields = JsonParseUtil.parseJsonArray(json.getJSONArray("fields"), transitionFieldJsonParser); return new Transition(name, id, fields); }  Transition parse(JSONObject json, int id);  }
@Test public void testParse() throws Exception { final TransitionJsonParser parser = new TransitionJsonParser(); final Transition transition = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/transition/valid.json"), 5); assertEquals(4, Iterables.size(transition.getFields())); assertEquals(new Transition.Field("assignee", false, "com.opensymphony.user.User"), Iterables.getLast(transition.getFields())); assertEquals(5, transition.getId()); }