@Test public void testSetKeywords() { 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); List<String> keywords = Arrays.asList("keyword[new]","keyword[0] - updated", "keyword[3] - updated"); SubjectMapper instance = new SubjectMapper(mods); instance.setKeywords(keywords); List<String> result = instance.getKeywords(); List<String> expect = Arrays.asList("keyword[new]","keyword[0] - updated", "keyword[3] - updated"); assertThat(result, Is.is(expect)); }
public void setKeywords(List<String> keywords) { keywords = MapperUtils.noNull(keywords); SubjectDefinition subjectNode = getSubjectNode(true); List<StringPlusLanguagePlusAuthority> oldies = subjectNode.getTopic(); oldies.clear(); oldies.addAll(MapperUtils.toStringPlusLanguagePlusAuthority(keywords)); }
SubjectMapper { public void setKeywords(List<String> keywords) { keywords = MapperUtils.noNull(keywords); SubjectDefinition subjectNode = getSubjectNode(true); List<StringPlusLanguagePlusAuthority> oldies = subjectNode.getTopic(); oldies.clear(); oldies.addAll(MapperUtils.toStringPlusLanguagePlusAuthority(keywords)); } }
SubjectMapper { public void setKeywords(List<String> keywords) { keywords = MapperUtils.noNull(keywords); SubjectDefinition subjectNode = getSubjectNode(true); List<StringPlusLanguagePlusAuthority> oldies = subjectNode.getTopic(); oldies.clear(); oldies.addAll(MapperUtils.toStringPlusLanguagePlusAuthority(keywords)); } SubjectMapper(ModsDefinition mods); }
SubjectMapper { public void setKeywords(List<String> keywords) { keywords = MapperUtils.noNull(keywords); SubjectDefinition subjectNode = getSubjectNode(true); List<StringPlusLanguagePlusAuthority> oldies = subjectNode.getTopic(); oldies.clear(); oldies.addAll(MapperUtils.toStringPlusLanguagePlusAuthority(keywords)); } SubjectMapper(ModsDefinition mods); List<String> getKeywords(); void setKeywords(List<String> keywords); }
SubjectMapper { public void setKeywords(List<String> keywords) { keywords = MapperUtils.noNull(keywords); SubjectDefinition subjectNode = getSubjectNode(true); List<StringPlusLanguagePlusAuthority> oldies = subjectNode.getTopic(); oldies.clear(); oldies.addAll(MapperUtils.toStringPlusLanguagePlusAuthority(keywords)); } SubjectMapper(ModsDefinition mods); List<String> getKeywords(); void setKeywords(List<String> keywords);  }