Program: 25743
Project: 25743
Buggy source:
@Test public void optionalValues() throws Exception {
  JsonNode data=BridgeObjectMapper.get().readTree("String_Node_Str");
  JsonNode metadata=BridgeObjectMapper.get().readTree("String_Node_Str");
  long arbitraryTimestamp=1424136378727L;
  LocalDate uploadDate=new LocalDate(2014,2,12);
  HealthDataRecord record=DAO.getRecordBuilder().withData(data).withHealthCode("String_Node_Str").withId("String_Node_Str").withCreatedOn(arbitraryTimestamp).withMetadata(metadata).withSchemaId("String_Node_Str").withSchemaRevision(3).withStudyId("String_Node_Str").withUploadDate(uploadDate).build();
  assertEquals("String_Node_Str",record.getHealthCode());
  assertEquals("String_Node_Str",record.getId());
  assertEquals(arbitraryTimestamp,record.getCreatedOn().longValue());
  assertEquals("String_Node_Str",record.getSchemaId());
  assertEquals(3,record.getSchemaRevision());
  assertEquals("String_Node_Str",record.getStudyId());
  assertEquals("String_Node_Str",record.getUploadDate().toString(ISODateTimeFormat.date()));
  assertEquals(1,record.getData().size());
  assertEquals("String_Node_Str",record.getData().get("String_Node_Str").asText());
  assertEquals(1,record.getMetadata().size());
  assertEquals("String_Node_Str",record.getMetadata().get("String_Node_Str").asText());
}

Fixed version (ground truth):
@Test public void optionalValues() throws Exception {
  JsonNode data=BridgeObjectMapper.get().readTree("String_Node_Str");
  JsonNode metadata=BridgeObjectMapper.get().readTree("String_Node_Str");
  long arbitraryTimestamp=1424136378727L;
  LocalDate uploadDate=new LocalDate(2014,2,12);
  HealthDataRecord record=DAO.getRecordBuilder().withData(data).withHealthCode("String_Node_Str").withId("String_Node_Str").withCreatedOn(arbitraryTimestamp).withMetadata(metadata).withSchemaId("String_Node_Str").withSchemaRevision(3).withStudyId("String_Node_Str").withUploadDate(uploadDate).withUploadId("String_Node_Str").withUserExternalId("String_Node_Str").withUserSharingScope(ParticipantOption.SharingScope.SPONSORS_AND_PARTNERS).withVersion(42L).build();
  assertEquals("String_Node_Str",record.getHealthCode());
  assertEquals("String_Node_Str",record.getId());
  assertEquals(arbitraryTimestamp,record.getCreatedOn().longValue());
  assertEquals("String_Node_Str",record.getSchemaId());
  assertEquals(3,record.getSchemaRevision());
  assertEquals("String_Node_Str",record.getStudyId());
  assertEquals("String_Node_Str",record.getUploadDate().toString(ISODateTimeFormat.date()));
  assertEquals("String_Node_Str",record.getUploadId());
  assertEquals("String_Node_Str",record.getUserExternalId());
  assertEquals(ParticipantOption.SharingScope.SPONSORS_AND_PARTNERS,record.getUserSharingScope());
  assertEquals(42,record.getVersion().longValue());
  assertEquals(1,record.getData().size());
  assertEquals("String_Node_Str",record.getData().get("String_Node_Str").asText());
  assertEquals(1,record.getMetadata().size());
  assertEquals("String_Node_Str",record.getMetadata().get("String_Node_Str").asText());
  HealthDataRecord copyRecord=DAO.getRecordBuilder().copyOf(record).build();
  assertEquals("String_Node_Str",copyRecord.getHealthCode());
  assertEquals("String_Node_Str",copyRecord.getId());
  assertEquals(arbitraryTimestamp,copyRecord.getCreatedOn().longValue());
  assertEquals("String_Node_Str",copyRecord.getSchemaId());
  assertEquals(3,copyRecord.getSchemaRevision());
  assertEquals("String_Node_Str",copyRecord.getStudyId());
  assertEquals("String_Node_Str",copyRecord.getUploadDate().toString(ISODateTimeFormat.date()));
  assertEquals("String_Node_Str",copyRecord.getUploadId());
  assertEquals("String_Node_Str",copyRecord.getUserExternalId());
  assertEquals(ParticipantOption.SharingScope.SPONSORS_AND_PARTNERS,copyRecord.getUserSharingScope());
  assertEquals(42,copyRecord.getVersion().longValue());
  assertEquals(1,copyRecord.getData().size());
  assertEquals("String_Node_Str",copyRecord.getData().get("String_Node_Str").asText());
  assertEquals(1,copyRecord.getMetadata().size());
  assertEquals("String_Node_Str",copyRecord.getMetadata().get("String_Node_Str").asText());
}