### Question:
Location extends AbstractReport { @Override public void print(PrintStream out, StringBuilder ret, int level, boolean first) { ret.setLength(0); out.print(addLevel(ret, level).append('{')); first = true; if (file != null) { printObject(out, ret, level + 1, "file", file, first); first = false; } if (objectId != null) { out.print(toJsonString(ret, level + 1, "objectid", objectId, first)); first = false; } if (name != null) { out.print(toJsonString(ret, level + 1, "label", name, first)); first = false; } if (!objectRefs.isEmpty()) { printArray(out, ret, level + 1, "object_path", objectRefs, first); first = false; } ret.setLength(0); out.print(addLevel(ret.append('\n'), level).append('}')); } Location(DataLocation dl);  Location(String fileName);  Location(String fileName, String locationName);  Location(String fileName, String locationName, int lineNumber, String objectId);  Location(String fileName, String locationName, int lineNumber, int columnNumber, String objectId);  Location(String fileName, String locationName, int lineNumber);  Location(String fileName, int lineNumber, int columnNumber);  Location(String fileName, int lineNumber, int columnNumber, String objectId);  Location(NeptuneIdentifiedObject chouetteObject); static String buildName(NeptuneIdentifiedObject chouetteObject); @Override void print(PrintStream out, StringBuilder ret, int level, boolean first);  }### Answer:
@Test(groups = { "JsonGeneration" }, description = "Json generated", priority = 104) public void verifyJsonGeneration() throws Exception { { ByteArrayOutputStream oStream = new ByteArrayOutputStream(); PrintStream stream = new PrintStream(oStream); Location location = new Location("fileName", 0, 0); location.print(stream, new StringBuilder(), 1, true); String text = oStream.toString(); JSONObject res = new JSONObject(text); Assert.assertNotNull(res.getJSONObject("file") , "location file shall not be null"); } { ByteArrayOutputStream oStream = new ByteArrayOutputStream(); PrintStream stream = new PrintStream(oStream); Location location = new Location("fileName", 0, 0, "neptune"); location.print(stream, new StringBuilder(), 1, true); String text = oStream.toString(); JSONObject res = new JSONObject(text); Assert.assertEquals(res.getString("objectid") , "neptune", "wrong location object id"); } { ByteArrayOutputStream oStream = new ByteArrayOutputStream(); PrintStream stream = new PrintStream(oStream); Location location = new Location("fileName", "locationName", 0); location.print(stream, new StringBuilder(), 1, true); String text = oStream.toString(); JSONObject res = new JSONObject(text); Assert.assertEquals(res.getString("label") , "locationName", "wrong location object name"); } { ByteArrayOutputStream oStream = new ByteArrayOutputStream(); PrintStream stream = new PrintStream(oStream); JourneyPattern jp = new JourneyPattern(); Route route = new Route(); route.setObjectId("route1"); route.setName("rname"); Line line = new Line(); line.setObjectId("line1"); line.setName("lname"); route.setLine(line); jp.setRoute(route); Location location = new Location(jp); location.print(stream, new StringBuilder(), 1, true); String text = oStream.toString(); JSONObject res = new JSONObject(text); JSONArray objectRef = res.getJSONArray("object_path"); Assert.assertNotNull(objectRef.get(0), "journey pattern reference shall not be null"); } }