@Test public void testMarcAsMods_AuthorityId_Issue305() throws Exception { InputStream xmlIS = TransformersTest.class.getResourceAsStream("marc_subject_65X_X9.xml"); assertNotNull(xmlIS); StreamSource streamSource = new StreamSource(xmlIS); Transformers mt = new Transformers(); try { byte[] contents = mt.transformAsBytes(streamSource, Transformers.Format.MarcxmlAsMods3); assertNotNull(contents); String xmlResult = new String(contents, "UTF-8"); XMLUnit.setXpathNamespaceContext(new SimpleNamespaceContext(new HashMap() {{ put("m", ModsConstants.NS); }})); XMLAssert.assertXpathExists("/m:mods/m:name[@type='personal'" + " and @authorityURI='http: + " and @valueURI='http: + "/m:namePart[@type='family' and text()='Kocina']" + "/../m:namePart[@type='given' and text()='Jan']" + "/../m:namePart[@type='date' and text()='1960-']" + "/../m:role/m:roleTerm[text()='aut']", xmlResult); XMLAssert.assertXpathExists("/m:mods/m:name[@type='personal'" + " and @authorityURI='http: + " and @valueURI='http: + "/m:namePart[@type='family' and text()='Honzík']" + "/../m:namePart[@type='given' and text()='Bohumil']" + "/../m:namePart[@type='date' and text()='1972-']" + "/../m:role/m:roleTerm[text()='aut']", xmlResult); XMLAssert.assertXpathExists("/m:mods/m:name[@type='personal'" + " and not(@authorityURI)" + " and not(@valueURI)]" + "/m:namePart[text()='Test Without AuthorityId']" + "/../m:namePart[@type='date' and text()='1972-']" + "/../m:role/m:roleTerm[text()='aut']", xmlResult); validateMods(new StreamSource(new ByteArrayInputStream(contents))); } finally { close(xmlIS); } }
public byte[] transformAsBytes(Source input, Format format) throws TransformerException { return transformAsBytes(input, format, Collections.<String, Object>emptyMap()); }
Transformers { public byte[] transformAsBytes(Source input, Format format) throws TransformerException { return transformAsBytes(input, format, Collections.<String, Object>emptyMap()); } }
Transformers { public byte[] transformAsBytes(Source input, Format format) throws TransformerException { return transformAsBytes(input, format, Collections.<String, Object>emptyMap()); }  }
Transformers { public byte[] transformAsBytes(Source input, Format format) throws TransformerException { return transformAsBytes(input, format, Collections.<String, Object>emptyMap()); }  Source transform(Source input, Format format); Source transform(Source input, Format format, Map<String, Object> params); byte[] transformAsBytes(Source input, Format format); byte[] transformAsBytes(Source input, Format format, Map<String, Object> params); Source toSource(byte[] buffer); Source dump(Source source, StringBuilder dump); Source dump2Temp(Source source, String filename); }
Transformers { public byte[] transformAsBytes(Source input, Format format) throws TransformerException { return transformAsBytes(input, format, Collections.<String, Object>emptyMap()); }  Source transform(Source input, Format format); Source transform(Source input, Format format, Map<String, Object> params); byte[] transformAsBytes(Source input, Format format); byte[] transformAsBytes(Source input, Format format, Map<String, Object> params); Source toSource(byte[] buffer); Source dump(Source source, StringBuilder dump); Source dump2Temp(Source source, String filename);  }