@Test public void testCreateLabel() { String xml = "<mods version='3.5' xmlns='http://www.loc.gov/mods/v3'>" + "<titleInfo>" + "<nonSort>NS1</nonSort><title>T1</title><subTitle>S1</subTitle><partName>PNam1</partName><partNumber>PNum1</partNumber>" + "</titleInfo>" + "<titleInfo>" + "<title>T2</title><subTitle>S2</subTitle>" + "</titleInfo>" + "</mods>"; ModsDefinition mods = ModsUtils.unmarshalModsType(new StreamSource(new StringReader(xml))); NdkPeriodicalMapper mapper = new NdkPeriodicalMapper(); String result = mapper.createObjectLabel(mods); assertEquals("NS1 T1: S1. PNum1. PNam1", result); }
@Test public void testCreateDc() { String xml = "<mods version='3.5' xmlns='http://www.loc.gov/mods/v3'>" + "<titleInfo>" + "<nonSort>NS1</nonSort><title>T1</title><subTitle>S1</subTitle><partName>PNam1</partName><partNumber>PNum1</partNumber>" + "</titleInfo>" + "<titleInfo>" + "<title>T2</title><subTitle>S2</subTitle>" + "</titleInfo>" + "</mods>"; ModsDefinition mods = ModsUtils.unmarshalModsType(new StreamSource(new StringReader(xml))); NdkPeriodicalMapper mapper = new NdkPeriodicalMapper(); Context ctx = new Context("uuid:testId"); OaiDcType result = mapper.createDc(mods, ctx); assertEquals("NS1 T1: S1", result.getTitles().get(0).getValue()); assertEquals("T2: S2", result.getTitles().get(1).getValue()); assertEquals("PNum1", result.getDescriptions().get(0).getValue()); assertEquals("PNam1", result.getDescriptions().get(1).getValue()); }