SubjectMapper { public List<String> getKeywords() { SubjectDefinition subjectNode = getSubjectNode(false); List<String> keywords = Collections.emptyList(); if (subjectNode != null) { keywords = MapperUtils.toStringPlusLanguageValue(subjectNode.getTopic()); } return keywords; } SubjectMapper(ModsDefinition mods); List<String> getKeywords(); void setKeywords(List<String> keywords);  }
@Test public void testGetKeywords() { String xml = "<mods xmlns='http: + "<subject>" + "<topic>keyword[0]</topic>" + "<topic>keyword[1]</topic>" + "<genre>genre[2]</genre>" + "<topic>keyword[3]</topic>" + "</subject>" + "</mods>"; ModsDefinition mods = ModsUtils.unmarshal(xml, ModsDefinition.class); SubjectMapper instance = new SubjectMapper(mods); List<String> result = instance.getKeywords(); List<String> expect = Arrays.asList("keyword[0]", "keyword[1]", "keyword[3]"); assertThat(result, Is.is(expect)); }