Author: rfscholte
Date: Fri Jan 24 21:18:28 2014
New Revision: 1561187

URL: http://svn.apache.org/r1561187
Log:
Add tests for AbstractSink.unifyEOLs

Added:
    
maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/TestAbstractSink.java

Added: 
maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/TestAbstractSink.java
URL: 
http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/TestAbstractSink.java?rev=1561187&view=auto
==============================================================================
--- 
maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/TestAbstractSink.java
 (added)
+++ 
maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/sink/TestAbstractSink.java
 Fri Jan 24 21:18:28 2014
@@ -0,0 +1,48 @@
+package org.apache.maven.doxia.sink;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import junit.framework.TestCase;
+
+public class TestAbstractSink
+    extends TestCase
+{
+
+    public void testUnifiedEOL()
+    {
+        String EOL = AbstractSink.EOL;
+        String EOL_MACOS9 = "\r";
+        String EOL_UNIX = "\n";
+        String EOL_WIN = "\r\n";
+
+        assertEquals( "Hello " + EOL + " world", AbstractSink.unifyEOLs( 
"Hello " + EOL_MACOS9 + " world" ) );
+        assertEquals( "Hello " + EOL + " world", AbstractSink.unifyEOLs( 
"Hello " + EOL_UNIX + " world" ) );
+        assertEquals( "Hello " + EOL + " world", AbstractSink.unifyEOLs( 
"Hello " + EOL_WIN + " world" ) );
+
+        assertEquals( "Hello world" + EOL, AbstractSink.unifyEOLs( "Hello 
world" + EOL_MACOS9 ) );
+        assertEquals( "Hello world" + EOL, AbstractSink.unifyEOLs( "Hello 
world" + EOL_UNIX ) );
+        assertEquals( "Hello world" + EOL, AbstractSink.unifyEOLs( "Hello 
world" + EOL_WIN ) );
+
+        assertEquals( EOL + "Hello world", AbstractSink.unifyEOLs( EOL_MACOS9 
+ "Hello world" ) );
+        assertEquals( EOL + "Hello world", AbstractSink.unifyEOLs( EOL_UNIX + 
"Hello world" ) );
+        assertEquals( EOL + "Hello world", AbstractSink.unifyEOLs( EOL_WIN + 
"Hello world" ) );
+    }
+
+}


Reply via email to