@Test
public void testGetPublishingEvent() throws Exception
{

    // Mock up ContentReader to do nothing. Not testing payload deserialization.
    ContentReader reader = mock(ContentReader.class);
    InputStream inputStream = mock(InputStream.class);
    when(reader.getContentInputStream()).thenReturn(inputStream);
    when(contentService.getReader(any(NodeRef.class), any(QName.class)))
        .thenReturn(reader);
    NodeSnapshotSerializer serializer = mock(NodeSnapshotSerializer.class);
    helper.setSerializer(serializer);
    
    PublishingEvent result = helper.getPublishingEvent((NodeRef)null);
    assertNull(result);
    
    String comment = "The comment";
    Status status = Status.COMPLETED;
    Date modified= new Date();
    Date created = new Date(modified.getTime()-3600000);
    String creatorName = "The creator";
    String modifierName = "The modifier";
    Calendar schedule = Calendar.getInstance();
    schedule.add(Calendar.MONTH, 6);
    Date scheduledTime = schedule.getTime();
    String scheduledTimeZone = schedule.getTimeZone().getID();
    
    // Mock up node properties.
    Map<QName, Serializable> props = new HashMap<QName, Serializable>();
    props.put(PROP_PUBLISHING_EVENT_COMMENT, comment);
    props.put(PROP_PUBLISHING_EVENT_STATUS, status.name());
    props.put(PROP_PUBLISHING_EVENT_TIME, scheduledTime);
    props.put(PROP_PUBLISHING_EVENT_TIME_ZONE, scheduledTimeZone);
    props.put(ContentModel.PROP_CREATED, created);
    props.put(ContentModel.PROP_CREATOR, creatorName);
    props.put(ContentModel.PROP_MODIFIED, modified);
    props.put(ContentModel.PROP_MODIFIER, modifierName);
    
    NodeRef eventNode = new NodeRef("foo://bar/eventNode");
    when(nodeService.getProperties(eventNode)).thenReturn(props);
    
    result = helper.getPublishingEvent(eventNode);
    assertEquals(eventNode.toString(), result.getId());
    assertEquals(comment, result.getComment());
    assertEquals(status, result.getStatus());
    assertEquals(schedule, result.getScheduledTime());
    assertEquals(created, result.getCreatedTime());
    assertEquals(creatorName, result.getCreator());
    assertEquals(modified, result.getModifiedTime());
    assertEquals(modifierName, result.getModifier());
}