### Question:
DocCheck { private static void checkFields(StringBuilder errors, String context, List<Field> fields, FieldMap fieldMap) { if (fields != null) { for (Field field : fields) { if (field.getValues() != null) { for (FieldValue fieldValue : field.getValues()) { if (fieldValue.getLabelId() != null && fieldMap.getFieldValueDescriptor(fieldValue.getLabelId()) == null) { errors.append("Error 13: ").append(context).append(": Field with labelId '").append(fieldValue.getLabelId()).append("' had no FieldValueDescriptor\n"); } } } } } }  static String checkDocument(Gedcomx doc); static String checkDocument(Gedcomx doc, Gedcomx collection); static String checkRecordSet(RecordSet records, Gedcomx collection);  }### Answer:
@Test public void testDocCheckWithFields() throws JAXBException { Gedcomx record = MarshalUtil.unmarshal(getClass().getClassLoader().getResourceAsStream("gedcomx-record.xml")); Gedcomx collection = MarshalUtil.unmarshal(getClass().getClassLoader().getResourceAsStream("gedcomx-collection.xml")); checkFields(record, collection, "IMAGE_ID_NORM", "IMAGE_ARK"); FieldValue fieldValue = record.getPersons().get(0).getFacts().get(0).getDate().getFields().get(0).getValues().get(0); String labelId = fieldValue.getLabelId(); fieldValue.setLabelId(labelId + "_BROKEN"); checkFields(record, collection, "IMAGE_ID_NORM", "IMAGE_ARK", labelId + "_BROKEN"); }