Program: 172167
Project: 172167
Buggy source:
@Test public void testGetPublishingEvent() throws Exception {
  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);
  PublishingPackageSerializer serializer=mock(PublishingPackageSerializer.class);
  helper.setSerializer(serializer);
  PublishingEvent result=helper.getPublishingEvent((NodeRef)null);
  assertNull(result);
  String comment="String_Node_Str";
  Status status=Status.COMPLETE;
  Date modified=new Date();
  Date created=new Date(modified.getTime() - 3600000);
  String creatorName="String_Node_Str";
  String modifierName="String_Node_Str";
  Calendar schedule=Calendar.getInstance();
  schedule.add(Calendar.MONTH,6);
  Date scheduledTime=schedule.getTime();
  String scheduledTimeZone=schedule.getTimeZone().getID();
  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("String_Node_Str");
  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());
}

Fixed version (ground truth):
@Test public void testGetPublishingEvent() throws Exception {
  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);
  PublishingPackageSerializer serializer=mock(PublishingPackageSerializer.class);
  helper.setSerializer(serializer);
  PublishingEvent result=helper.getPublishingEvent((NodeRef)null);
  assertNull(result);
  String comment="String_Node_Str";
  Status status=Status.COMPLETED;
  Date modified=new Date();
  Date created=new Date(modified.getTime() - 3600000);
  String creatorName="String_Node_Str";
  String modifierName="String_Node_Str";
  Calendar schedule=Calendar.getInstance();
  schedule.add(Calendar.MONTH,6);
  Date scheduledTime=schedule.getTime();
  String scheduledTimeZone=schedule.getTimeZone().getID();
  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("String_Node_Str");
  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());
}