Author: fguillaume
Date: Wed Feb 10 16:56:51 2010
New Revision: 908585
URL: http://svn.apache.org/viewvc?rev=908585&view=rev
Log:
CMIS-101: fix test on Windows
Modified:
incubator/chemistry/trunk/chemistry/chemistry-commons/src/test/java/org/apache/chemistry/xml/stax/TestXMLWriter.java
Modified:
incubator/chemistry/trunk/chemistry/chemistry-commons/src/test/java/org/apache/chemistry/xml/stax/TestXMLWriter.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/test/java/org/apache/chemistry/xml/stax/TestXMLWriter.java?rev=908585&r1=908584&r2=908585&view=diff
==============================================================================
---
incubator/chemistry/trunk/chemistry/chemistry-commons/src/test/java/org/apache/chemistry/xml/stax/TestXMLWriter.java
(original)
+++
incubator/chemistry/trunk/chemistry/chemistry-commons/src/test/java/org/apache/chemistry/xml/stax/TestXMLWriter.java
Wed Feb 10 16:56:51 2010
@@ -14,6 +14,7 @@
* Authors:
* Bogdan Stefanescu, Nuxeo
* Florent Guillaume, Nuxeo
+ * Jeffrey Knight
*/
package org.apache.chemistry.xml.stax;
@@ -40,6 +41,11 @@
public static final QName OBJECT = new QName(CMIS.CMIS_NS, "object",
CMIS.CMIS_PREFIX);
+ // cleanup whitespace and lines that may have been read on Windows
+ protected static String cleanup(String s) {
+ return s.replace("\r", "").trim();
+ }
+
public void testXMLWriter() throws Exception {
Writer w = new StringWriter();
XMLWriter x = new XMLWriter(w, 2);
@@ -74,15 +80,16 @@
String expected = toString(new InputStreamReader(stream, "UTF-8"));
stream.close();
- assertEquals(expected.trim(), actual.trim());
+ assertEquals(cleanup(expected), cleanup(actual));
}
// Regression test: test corner case when stream length = 3*19.
public void testEncodeBase64CornerCase() throws Exception {
Writer w = new StringWriter();
XMLWriter x = new XMLWriter(w, 2);
- String s = "abcdefghij" + "abcdefghij" + "abcdefghij" + "abcdefghij" +
"abcdefghij" + "abcdefg";
- assertEquals(3*19, s.length());
+ String s = "abcdefghij" + "abcdefghij" + "abcdefghij" + "abcdefghij"
+ + "abcdefghij" + "abcdefg";
+ assertEquals(3 * 19, s.length());
InputStream in = new ByteArrayInputStream(s.getBytes("UTF-8"));
x.start();