camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r642864 - /activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/converter/IOConverterTest.java
Date Mon, 31 Mar 2008 03:36:55 GMT
Author: ningjiang
Date: Sun Mar 30 20:36:51 2008
New Revision: 642864

URL: http://svn.apache.org/viewvc?rev=642864&view=rev
Log:
Fixed the unit test of IOConverterTest failed on Windows Box

Modified:
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/converter/IOConverterTest.java

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/converter/IOConverterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/converter/IOConverterTest.java?rev=642864&r1=642863&r2=642864&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/converter/IOConverterTest.java
(original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/converter/IOConverterTest.java
Sun Mar 30 20:36:51 2008
@@ -28,26 +28,32 @@
  * Test case for {@link IOConverter}
  */
 public class IOConverterTest extends TestCase {
-    
+
     private static final byte[] TESTDATA = "My test data".getBytes();
-    
+
     public void testToBytes() throws FileNotFoundException, IOException {
+        int fileSize = 962;
         byte[] data = IOConverter.toBytes(new FileInputStream("src/test/resources/org/apache/camel/converter/dummy.txt"));
-        assertEquals(962, data.length);
+        // since we set the dummy.txt svn property svn:eol-style to be native,
+        // the file size could be different when you run the test in Windows box
+        if (System.getProperty("os.name").startsWith("Windows")) {
+            fileSize = 979;
+        }
+        assertEquals("get the wrong byte size", fileSize, data.length);
         assertEquals('#', (char) data[0]);
         assertEquals('!', (char) data[data.length - 1]);
     }
-    
+
     public void testCopy() throws IOException {
         ByteArrayInputStream bis = new ByteArrayInputStream(TESTDATA);
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         IOConverter.copy(bis, bos);
         assertEquals(TESTDATA, bos.toByteArray());
     }
-    
+
     private void assertEquals(byte[] data1, byte[] data2) {
         assertEquals(data1.length, data2.length);
-        for (int i = 0 ; i < data1.length ; i++) {
+        for (int i = 0; i < data1.length; i++) {
             assertEquals(data1[i], data2[i]);
         }
     }



Mime
View raw message