fix IndentXMLStreamWriterTest on windows

This commit is contained in:
Sebastian Sdorra
2014-05-07 08:45:07 +02:00
parent 62fe0366d7
commit 24b424f483
2 changed files with 11 additions and 10 deletions

View File

@@ -34,6 +34,7 @@ package sonia.scm.xml;
//~--- JDK imports ------------------------------------------------------------
import com.google.common.annotations.VisibleForTesting;
import javax.xml.namespace.NamespaceContext;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
@@ -48,7 +49,8 @@ public final class IndentXMLStreamWriter implements XMLStreamWriter
{
/** line separator */
private static final String LINE_SEPARATOR =
@VisibleForTesting
static final String LINE_SEPARATOR =
System.getProperty("line.separator");
//~--- constructors ---------------------------------------------------------

View File

@@ -86,15 +86,14 @@ public class IndentXMLStreamWriterTest
String content = baos.toString();
//J-
Assert.assertEquals(
"<?xml version=\"1.0\" ?>\n" +
"<root>\n" +
" <message>Hello</message>\n" +
"</root>\n",
content
);
//J
StringBuilder buffer = new StringBuilder("<?xml version=\"1.0\" ?>");
buffer.append(IndentXMLStreamWriter.LINE_SEPARATOR);
buffer.append("<root>").append(IndentXMLStreamWriter.LINE_SEPARATOR);
buffer.append(" <message>Hello</message>");
buffer.append(IndentXMLStreamWriter.LINE_SEPARATOR);
buffer.append("</root>").append(IndentXMLStreamWriter.LINE_SEPARATOR);
Assert.assertEquals(buffer.toString(), content);
}