### Question:
PackageHelperImpl implements PackageHelper { public String getErrorJSON(final String msg) { Gson gson = new Gson(); final JsonObject json = new JsonObject(); json.addProperty(KEY_STATUS, "error"); json.addProperty(KEY_MSG, msg); return gson.toJson(json); }  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 testGetErrorJSON() throws Exception { final String expectedMessage = "This is a test error message!"; final String actual = packageHelper.getErrorJSON(expectedMessage); final JSONObject json = new JSONObject(actual); assertEquals("error", json.getString("status")); assertEquals(expectedMessage, json.getString("msg")); }