### Question:
PublicationEvent extends Event { public static PublicationEvent unpublish(PublishableResource resource, boolean deep) { Map<String, Object> properties = new HashMap<>(); properties.put(SlingConstants.PROPERTY_PATH, resource.getPath()); properties.put(PN_PUBLICATION_TYPE, PublicationType.DELETE.toString()); properties.put(PN_DEEP, deep); return new PublicationEvent(EVENT_UNPUBLISH, properties); } private  PublicationEvent(String topic, Map<String, ?> properties); static PublicationEvent publish(PublishableResource resource, boolean deep); static PublicationEvent unpublish(PublishableResource resource, boolean deep); static final String EVENT_PUBLISH; static final String EVENT_UNPUBLISH; static final String PN_PUBLICATION_TYPE; static final String PN_DEEP; }### Answer:
@Test public void testUnpublish() { PublishableResource resource = Mockito.mock(PublishableResource.class); Mockito.when(resource.getPath()).thenReturn("/content2"); PublicationEvent evt = PublicationEvent.unpublish(resource, true); assertEquals(PublicationEvent.EVENT_UNPUBLISH, evt.getTopic()); assertEquals("/content2", evt.getProperty(SlingConstants.PROPERTY_PATH)); assertEquals(true, evt.getProperty(PublicationEvent.PN_DEEP)); assertEquals(PublicationType.DELETE.toString(), evt.getProperty(PublicationEvent.PN_PUBLICATION_TYPE)); }