### Question:
StandalonePublicationManager implements PublicationManager { @Override public void unpublish(PublishableResource resource) throws PublicationException { try { ModifiableValueMap properties = Optional .ofNullable(resource.getContentResource().adaptTo(ModifiableValueMap.class)) .orElseThrow(() -> new PublicationException("Cannot modify resource")); properties.put(CMSConstants.PN_PUBLISHED, false); properties.put(CMSConstants.PN_LAST_PUBLICATION, Calendar.getInstance()); properties.put(CMSConstants.PN_LAST_PUBLICATION_TYPE, PublicationType.DELETE.toString()); resource.getResource().getResourceResolver().commit(); eventAdmin.postEvent(PublicationEvent.unpublish(resource, false)); } catch (PersistenceException e) { throw new PublicationException("Cannot save publication status", e); } } StandalonePublicationManager(EventAdmin eventAdmin); @Override void publish(PublishableResource resource); @Override void unpublish(PublishableResource resource); @Override PUBLICATION_MODE getPublicationMode();  }### Answer:
@Test public void testUnpublish() throws PublicationException { EventAdmin eventAdmin = Mockito.mock(EventAdmin.class); PublicationManager pman = new StandalonePublicationManager(eventAdmin); context.currentResource("/content/apache/sling-apache-org/index"); pman.unpublish(context.currentResource().adaptTo(Page.class)); Mockito.verify(eventAdmin).postEvent(Mockito.any()); ValueMap properties = context.currentResource().getChild("jcr:content").getValueMap(); assertEquals(false, properties.get(CMSConstants.PN_PUBLISHED, Boolean.class)); assertEquals("DELETE", properties.get(CMSConstants.PN_LAST_PUBLICATION_TYPE, String.class)); }