### Question:
PackageHelperImpl implements PackageHelper { public String getSuccessJSON(final JcrPackage jcrPackage) throws RepositoryException { final JsonObject json = new JsonObject(); json.addProperty(KEY_STATUS, "success"); json.addProperty(KEY_PATH, jcrPackage.getNode().getPath()); JsonArray filterSetsArray = new JsonArray(); json.add(KEY_FILTER_SETS, filterSetsArray); final List<PathFilterSet> filterSets = jcrPackage.getDefinition().getMetaInf().getFilter().getFilterSets(); for (final PathFilterSet filterSet : filterSets) { final JsonObject jsonFilterSet = new JsonObject(); jsonFilterSet.addProperty(KEY_IMPORT_MODE, filterSet.getImportMode().name()); jsonFilterSet.addProperty(KEY_ROOT_PATH, filterSet.getRoot()); filterSetsArray.add(jsonFilterSet); } return json.toString(); }  void addThumbnail(final JcrPackage jcrPackage, Resource thumbnailResource); @SuppressWarnings("squid:S3776") Version getNextVersion(final JcrPackageManager jcrPackageManager,
            final String groupName, final String name,
            final String version); void removePackage(final JcrPackageManager jcrPackageManager,
            final String groupName, final String name,
            final String version); JcrPackage createPackage(final Collection<Resource> resources, final Session session,
            final String groupName, final String name, String version,
            final ConflictResolution conflictResolution,
            final Map<String, String> packageDefinitionProperties); @Override JcrPackage createPackageForPaths(final Collection<String> paths, final Session session,
            final String groupName, String name, final String version,
            final ConflictResolution conflictResolution,
            Map<String, String> packageDefinitionProperties); JcrPackage createPackageFromPathFilterSets(final Collection<PathFilterSet> pathFilterSets,
            final Session session,
            final String groupName, final String name, String version,
            final ConflictResolution conflictResolution,
            final Map<String, String> packageDefinitionProperties); List<String> getContents(final JcrPackage jcrPackage); String getSuccessJSON(final JcrPackage jcrPackage); String getPreviewJSON(final Collection<Resource> resources); String getPreviewJSONForPaths(Collection<String> paths); String getPathFilterSetPreviewJSON(final Collection<PathFilterSet> pathFilterSets); String getErrorJSON(final String msg);  }### Answer:
@Test public void testGetSuccessJSON() throws Exception { final String actual = packageHelper.getSuccessJSON(packageOne); final JSONObject json = new JSONObject(actual); assertEquals("success", json.getString("status")); assertEquals("/etc/packages/testGroup/testPackageName-1.0.0.zip", json.getString("path")); final String[] expectedFilterSets = new String[]{ "/a/b/c", "/d/e/f", "/g/h/i" }; JSONArray actualArray = json.getJSONArray("filterSets"); for(int i = 0; i < actualArray.length(); i++) { JSONObject tmp = actualArray.getJSONObject(i); assertTrue(ArrayUtils.contains(expectedFilterSets, tmp.get("rootPath"))); } assertEquals(expectedFilterSets.length, actualArray.length()); }