### Question:
TreeJsonAction extends AbstractJsonAction { @Override public void execute() throws IOException { getContext().setContentType("application/json"); Simon simon = name == null ? getContext().getManager().getRootSimon() : findSimonByName(name); ObjectJS simonRootJS = createObjectJS(simon); simonRootJS.write(getContext().getWriter()); } TreeJsonAction(ActionContext context); @Override void readParameters(); @Override void execute(); static final String PATH; }### Answer:
@Test public void testExecute() throws Exception { TestActionContext context = new TestActionContext("/data/tree.json"); TreeJsonAction action = new TreeJsonAction(context); action.readParameters(); action.execute(); assertEquals(context.getContentType(), "application/json"); String json = context.toString(); JSONTokener jsonTokener = new JSONTokener(json); Set<String> names = new HashSet<>(); names.add("A"); names.add("B"); names.add("C"); Object object = jsonTokener.nextValue(); if (object instanceof JSONObject) { visitJSONObject((JSONObject) object, names); } assertTrue(names.isEmpty()); }