-
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2d6e37
commit 8029523
Showing
7 changed files
with
53 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/test/java/stax2/wstream/TestCopyEventFromReader132.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package stax2.wstream; | ||
|
||
import java.io.*; | ||
|
||
import org.codehaus.stax2.XMLInputFactory2; | ||
import org.codehaus.stax2.XMLOutputFactory2; | ||
import org.codehaus.stax2.XMLStreamReader2; | ||
import org.codehaus.stax2.XMLStreamWriter2; | ||
|
||
public class TestCopyEventFromReader132 | ||
extends BaseWriterTest | ||
{ | ||
// [woodstox-core#132] | ||
public void testCopyPIEvent() throws Exception { | ||
_testCopyPIEvent(true); | ||
_testCopyPIEvent(false); | ||
} | ||
|
||
private void _testCopyPIEvent(boolean preserveContents) throws Exception { | ||
final XMLInputFactory2 xmlIn = getInputFactory(); | ||
final XMLOutputFactory2 xmlOut = getOutputFactory(); | ||
String xml = "<description><?pi?>foo</description>"; | ||
|
||
XMLStreamReader2 reader = (XMLStreamReader2) xmlIn.createXMLStreamReader(new StringReader(xml)); | ||
StringWriter w = new StringWriter(); | ||
XMLStreamWriter2 writer = (XMLStreamWriter2) xmlOut.createXMLStreamWriter(w); | ||
while (reader.hasNext()) { | ||
reader.next(); | ||
writer.copyEventFromReader(reader, preserveContents); | ||
} | ||
reader.close(); | ||
writer.close(); | ||
|
||
assertEquals("<description><?pi ?>foo</description>", w.toString().trim()); | ||
} | ||
} |