### Question:
OnDeployScriptBase implements OnDeployScript { protected final void removeResource(String path) throws RepositoryException { Resource resource = resourceResolver.getResource(path); if (resource != null) { logger.info("Deleting node at {}", path); session.removeItem(path); } else { logger.info("Node at {} has already been removed", path); } }  final void execute(ResourceResolver resourceResolver);  }### Answer:
@Test public void testRemoveResourceWhenDoesNotExist() throws RepositoryException { final Resource resourceToDelete = resourceResolver.getResource("/content/bogus"); assertNull(resourceToDelete); onDeployScript.removeResource("/content/bogus"); assertLogText("Node at /content/bogus has already been removed"); }
@Test public void testRemoveResourceWhenExists() throws RepositoryException { Resource resourceToDelete = resourceResolver.getResource("/content/to-delete"); assertNotNull(resourceToDelete); onDeployScript.removeResource("/content/to-delete"); resourceToDelete = resourceResolver.getResource("/content/to-delete"); assertNull(resourceToDelete); }