src/test/java/gov/usgs/cida/pubs/transform/CrossrefTransformerIT.java
@Test
	public void testPubWithDataRelease() throws IOException {
		Publication<?> pub = CrossrefTestPubBuilder.buildNumberedSeriesPub(new Publication<>());
		PublicationLink<?> link = CrossrefTestPubBuilder.buildDataReleaseLink();
		pub.getLinks().add(link);

		instance.writeResult(pub);
		instance.end();

		String output = new String(target.toByteArray(), PubsConstantsHelper.DEFAULT_ENCODING);
		assertTrue(StringUtils.isNotBlank(output), "The XML was null or empty.");
		assertDoesNotThrow(() -> {
			docBuilder.parse(new InputSource(new StringReader(output)));
		}, "The XML is not well-formed.");

		String expected = harmonizeXml(updateWarehouseEndpoint(testOneNumberedSeriesXml));
		String dataReleaseDesc = link.getDescription() + link.getHelpText();
		String doi = "10.5066/P944FPA4";
		String dataReleaseXml = getDataReleaseXml(dataReleaseDesc, doi);
		expected = expected.replace("<doi_data>", dataReleaseXml + "<doi_data>");

		String actual = harmonizeXml(output);
		assertEquals(expected, actual);
	}
/**
	 * Test publication containing a data release.
	 */
Test publication containing a data release.
Test publication containing a data release .
@Test
	public void testPubWithDataRelease() throws IOException {
		Publication<?> pub = CrossrefTestPubBuilder.buildNumberedSeriesPub(new Publication<>());
		PublicationLink<?> link = CrossrefTestPubBuilder.buildDataReleaseLink();
		pub.getLinks().add(link);
		instance.writeResult(pub);
		instance.end();
		String output = new String(target.toByteArray(), PubsConstantsHelper.DEFAULT_ENCODING);
		assertTrue(StringUtils.isNotBlank(output), "The XML was null or empty.");
		assertDoesNotThrow(() -> {
			docBuilder.parse(new InputSource(new StringReader(output)));
		}, "The XML is not well-formed.");
		String expected = harmonizeXml(updateWarehouseEndpoint(testOneNumberedSeriesXml));
		String dataReleaseDesc = link.getDescription() + link.getHelpText();
		String doi = "10.5066/P944FPA4";
		String dataReleaseXml = getDataReleaseXml(dataReleaseDesc, doi);
		expected = expected.replace("<doi_data>", dataReleaseXml + "<doi_data>");
		String actual = harmonizeXml(output);
		assertEquals(expected, actual);
	}
@ Test public void testPubWithDataRelease ( ) throws IOException { Publication < ? > pub = CrossrefTestPubBuilder . buildNumberedSeriesPub ( new Publication < > ( ) ) ; PublicationLink < ? > link = CrossrefTestPubBuilder . buildDataReleaseLink ( ) ; pub . getLinks ( ) . add ( link ) ; instance . writeResult ( pub ) ; instance . end ( ) ; String output = new String ( target . toByteArray ( ) , PubsConstantsHelper . DEFAULT_ENCODING ) ; assertTrue ( StringUtils . isNotBlank ( output ) , "The XML was null or empty." ) ; assertDoesNotThrow ( ( ) -> { docBuilder . parse ( new InputSource ( new StringReader ( output ) ) ) ; } , "The XML is not well-formed." ) ; String expected = harmonizeXml ( updateWarehouseEndpoint ( testOneNumberedSeriesXml ) ) ; String dataReleaseDesc = link . getDescription ( ) + link . getHelpText ( ) ; String doi = "10.5066/P944FPA4" ; String dataReleaseXml = getDataReleaseXml ( dataReleaseDesc , doi ) ; expected = expected . replace ( "<doi_data>" , dataReleaseXml + "<doi_data>" ) ; String actual = harmonizeXml ( output ) ; assertEquals ( expected , actual ) ; }
Test publication containing a data release.
Test publication containing a data release .