@Test
public void testSurrogateAttributes() throws Exception {

  String surname = "\uD850\uDDAC";
  String given = "\uD842\uDFB7";
  String full = surname + given;
  Gedcomx doc = new Gedcomx();
  Name name = new Name(full, new NamePart(NamePartType.Surname, surname),
                       new NamePart(NamePartType.Given, given));
  doc.addPerson(new Person().id("p." + full).name(name));
  ByteArrayOutputStream bos = new ByteArrayOutputStream();
  RecordSetWriter cleanWriter = new RecordSetWriter(bos, false, Gedcomx.class, RecordSet.class);
  cleanWriter.writeRecord(doc);
  cleanWriter.close();
  RecordSetIterator recordSetIterator = new XmlRecordSetIterator(new ByteArrayInputStream(bos.toByteArray()), false);
  Gedcomx doc1 = recordSetIterator.next();
  //System.out.println("Orig: =====\n" + MarshalUtil.toXml(doc));
  //System.out.println("Then: =====\n" + MarshalUtil.toXml(doc1));
  NameForm nameForm = doc1.getPerson().getName().getNameForm();
  assertEquals(full, nameForm.getFullText());
  assertEquals(surname, nameForm.getParts().get(0).getValue());
  // This is where the standard XMLStreamReader causes the value to be surname + given instead of just given...
  assertEquals(given, nameForm.getParts().get(1).getValue());
}