### Question:
PackageHelperImpl implements PackageHelper { public String getPathFilterSetPreviewJSON(final Collection<PathFilterSet> pathFilterSets) { final JsonObject json = new JsonObject(); json.addProperty(KEY_STATUS, "preview"); json.addProperty(KEY_PATH, "Not applicable (Preview)"); JsonArray filterSets = new JsonArray(); json.add(KEY_FILTER_SETS, filterSets); for (final PathFilterSet pathFilterSet : pathFilterSets) { final JsonObject tmp = new JsonObject(); tmp.addProperty(KEY_IMPORT_MODE, "Not applicable (Preview)"); tmp.addProperty(KEY_ROOT_PATH, pathFilterSet.getRoot()); filterSets.add(tmp); } 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 testGetPathFilterSetPreviewJSON() throws Exception { final List<PathFilterSet> pathFilterSets = new ArrayList<PathFilterSet>(); pathFilterSets.add(new PathFilterSet("/a/b/c")); pathFilterSets.add(new PathFilterSet("/d/e/f")); pathFilterSets.add(new PathFilterSet("/g/h/i")); final String actual = packageHelper.getPathFilterSetPreviewJSON(pathFilterSets); final JSONObject json = new JSONObject(actual); assertEquals("preview", json.getString("status")); assertEquals("Not applicable (Preview)", 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()); }