### Question:
PackageHelperImpl implements PackageHelper { public void removePackage(final JcrPackageManager jcrPackageManager, final String groupName, final String name, final String version) throws RepositoryException { final PackageId packageId = new PackageId(groupName, name, version); final JcrPackage jcrPackage = jcrPackageManager.open(packageId); if (jcrPackage != null && jcrPackage.getNode() != null) { jcrPackage.getNode().remove(); jcrPackage.getNode().getSession().save(); } else { log.debug("Nothing to remove at: {} ", packageId.getInstallationPath()); } }  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 testRemovePackage() throws Exception { final PackageId packageId = new PackageId(packageGroup, packageName, packageOneVersion); when(jcrPackageManager.open(packageId)).thenReturn(packageOne); when(packageOneNode.getSession()).thenReturn(mock(Session.class)); packageHelper.removePackage(jcrPackageManager, packageGroup, packageName, packageOneVersion); verify(packageOneNode, times(1)).remove(); }