ExaminerNode extends DOMFragmentReader<List<Examiner>> { @Override public List<Examiner> read() { List<Examiner> examinerList = new ArrayList<Examiner>(); Examiner primary = readPrimaryExaminer(); if (primary != null) { examinerList.add(primary); } Examiner assistant = readAssistantExaminer(); if (assistant != null) { if (assistant.getDepartment() == null) { assistant.setDepartment(primary.getDepartment()); } examinerList.add(assistant); } return examinerList; } ExaminerNode(Document document); @Override List<Examiner> read(); Examiner readPrimaryExaminer(); Examiner readAssistantExaminer();  }
@Test public void Examiner() throws DocumentException { String xml = "<xml><us-bibliographic-data-grant><examiners><primary-examiner>\r\n" + "<last-name>Doe</last-name>\r\n" + "<first-name>John</first-name>\r\n" + "<department>1711</department>\r\n" + "</primary-examiner>\r\n" + "<assistant-examiner>\r\n" + "<last-name>Smith</last-name>\r\n" + "<first-name>Benjamin L</first-name>\r\n" + "</assistant-examiner>\r\n" + "</examiners></us-bibliographic-data-grant></xml>"; Document doc = DocumentHelper.parseText(xml); List<Examiner> examiners = new ExaminerNode(doc).read(); assertEquals("Doe", ((NamePerson) examiners.get(0).getName()).getLastName()); assertEquals("1711", examiners.get(0).getDepartment()); assertEquals(ExaminerType.PRIMARY, examiners.get(0).getExaminerType()); assertEquals("Smith", ((NamePerson) examiners.get(1).getName()).getLastName()); assertEquals("1711", examiners.get(1).getDepartment()); assertEquals(ExaminerType.ASSISTANT, examiners.get(1).getExaminerType()); }