Java Code Examples for org.springframework.util.xml.StaxUtils#createStaxResult()

The following examples show how to use org.springframework.util.xml.StaxUtils#createStaxResult() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XStreamMarshallerTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void marshalStaxResultXMLStreamWriter() throws Exception {
	XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
	StringWriter writer = new StringWriter();
	XMLStreamWriter streamWriter = outputFactory.createXMLStreamWriter(writer);
	Result result = StaxUtils.createStaxResult(streamWriter);
	marshaller.marshal(flight, result);
	assertThat("Marshaller writes invalid StreamResult", writer.toString(), isSimilarTo(EXPECTED_STRING));
}
 
Example 2
Source File: XStreamMarshallerTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void marshalStaxResultXMLEventWriter() throws Exception {
	XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
	StringWriter writer = new StringWriter();
	XMLEventWriter eventWriter = outputFactory.createXMLEventWriter(writer);
	Result result = StaxUtils.createStaxResult(eventWriter);
	marshaller.marshal(flight, result);
	assertThat("Marshaller writes invalid StreamResult", writer.toString(), isSimilarTo(EXPECTED_STRING));
}
 
Example 3
Source File: AbstractMarshallerTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void marshalStaxResultStreamWriter() throws Exception {
	XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
	StringWriter writer = new StringWriter();
	XMLStreamWriter streamWriter = outputFactory.createXMLStreamWriter(writer);
	Result result = StaxUtils.createStaxResult(streamWriter);
	marshaller.marshal(flights, result);
	assertThat("Marshaller writes invalid StreamResult", writer.toString(), isSimilarTo(EXPECTED_STRING));
}
 
Example 4
Source File: AbstractMarshallerTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void marshalStaxResultEventWriter() throws Exception {
	XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
	StringWriter writer = new StringWriter();
	XMLEventWriter eventWriter = outputFactory.createXMLEventWriter(writer);
	Result result = StaxUtils.createStaxResult(eventWriter);
	marshaller.marshal(flights, result);
	assertThat("Marshaller writes invalid StreamResult", writer.toString(), isSimilarTo(EXPECTED_STRING));
}
 
Example 5
Source File: XStreamMarshallerTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void marshalStaxResultXMLStreamWriter() throws Exception {
	XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
	StringWriter writer = new StringWriter();
	XMLStreamWriter streamWriter = outputFactory.createXMLStreamWriter(writer);
	Result result = StaxUtils.createStaxResult(streamWriter);
	marshaller.marshal(flight, result);
	assertThat("Marshaller writes invalid StreamResult", writer.toString(), isSimilarTo(EXPECTED_STRING));
}
 
Example 6
Source File: XStreamMarshallerTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void marshalStaxResultXMLEventWriter() throws Exception {
	XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
	StringWriter writer = new StringWriter();
	XMLEventWriter eventWriter = outputFactory.createXMLEventWriter(writer);
	Result result = StaxUtils.createStaxResult(eventWriter);
	marshaller.marshal(flight, result);
	assertThat("Marshaller writes invalid StreamResult", writer.toString(), isSimilarTo(EXPECTED_STRING));
}
 
Example 7
Source File: AbstractMarshallerTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void marshalStaxResultStreamWriter() throws Exception {
	XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
	StringWriter writer = new StringWriter();
	XMLStreamWriter streamWriter = outputFactory.createXMLStreamWriter(writer);
	Result result = StaxUtils.createStaxResult(streamWriter);
	marshaller.marshal(flights, result);
	assertThat("Marshaller writes invalid StreamResult", writer.toString(), isSimilarTo(EXPECTED_STRING));
}
 
Example 8
Source File: AbstractMarshallerTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void marshalStaxResultEventWriter() throws Exception {
	XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
	StringWriter writer = new StringWriter();
	XMLEventWriter eventWriter = outputFactory.createXMLEventWriter(writer);
	Result result = StaxUtils.createStaxResult(eventWriter);
	marshaller.marshal(flights, result);
	assertThat("Marshaller writes invalid StreamResult", writer.toString(), isSimilarTo(EXPECTED_STRING));
}
 
Example 9
Source File: XStreamMarshallerTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void marshalStaxResultXMLStreamWriter() throws Exception {
	XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
	StringWriter writer = new StringWriter();
	XMLStreamWriter streamWriter = outputFactory.createXMLStreamWriter(writer);
	Result result = StaxUtils.createStaxResult(streamWriter);
	marshaller.marshal(flight, result);
	assertXMLEqual("Marshaller writes invalid StreamResult", EXPECTED_STRING, writer.toString());
}
 
Example 10
Source File: XStreamMarshallerTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void marshalStaxResultXMLEventWriter() throws Exception {
	XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
	StringWriter writer = new StringWriter();
	XMLEventWriter eventWriter = outputFactory.createXMLEventWriter(writer);
	Result result = StaxUtils.createStaxResult(eventWriter);
	marshaller.marshal(flight, result);
	assertXMLEqual("Marshaller writes invalid StreamResult", EXPECTED_STRING, writer.toString());
}
 
Example 11
Source File: AbstractMarshallerTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void marshalStaxResultStreamWriter() throws Exception {
	XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
	StringWriter writer = new StringWriter();
	XMLStreamWriter streamWriter = outputFactory.createXMLStreamWriter(writer);
	Result result = StaxUtils.createStaxResult(streamWriter);
	marshaller.marshal(flights, result);
	assertXMLEqual("Marshaller writes invalid StreamResult", EXPECTED_STRING, writer.toString());
}
 
Example 12
Source File: AbstractMarshallerTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void marshalStaxResultEventWriter() throws Exception {
	XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
	StringWriter writer = new StringWriter();
	XMLEventWriter eventWriter = outputFactory.createXMLEventWriter(writer);
	Result result = StaxUtils.createStaxResult(eventWriter);
	marshaller.marshal(flights, result);
	assertXMLEqual("Marshaller writes invalid StreamResult", EXPECTED_STRING, writer.toString());
}