diff --git a/src/main/java/org/csveed/row/RowWriterImpl.java b/src/main/java/org/csveed/row/RowWriterImpl.java index 6ee98f8c..bb6c6e79 100644 --- a/src/main/java/org/csveed/row/RowWriterImpl.java +++ b/src/main/java/org/csveed/row/RowWriterImpl.java @@ -93,7 +93,7 @@ private void writeCells(Iterator cells) { } private void writeEOL() throws IOException { - writer.write(rowInstructions.getEndOfLine()); + writer.write("\r\n"); } private void writeSeparator() throws IOException { diff --git a/src/test/java/org/csveed/api/CsvClientTest.java b/src/test/java/org/csveed/api/CsvClientTest.java index b9c7353e..0f1b24d6 100644 --- a/src/test/java/org/csveed/api/CsvClientTest.java +++ b/src/test/java/org/csveed/api/CsvClientTest.java @@ -29,10 +29,10 @@ public void writeBeansBasedOnClass() throws IOException { client.writeBeans(beans); writer.close(); assertEquals( - "\"gamma\";\"beta\";\"alpha\"\r"+ - "\"row 1, cell 1\";\"row 1, cell 2\";\"row 1, cell 3\"\r"+ - "\"row 2, cell 1\";\"row 2, cell 2\";\"row 2, cell 3\"\r"+ - "\"row 3, cell 1\";\"row 3, cell 2\";\"row 3, cell 3\"\r", + "\"gamma\";\"beta\";\"alpha\"\r\n"+ + "\"row 1, cell 1\";\"row 1, cell 2\";\"row 1, cell 3\"\r\n"+ + "\"row 2, cell 1\";\"row 2, cell 2\";\"row 2, cell 3\"\r\n"+ + "\"row 3, cell 1\";\"row 3, cell 2\";\"row 3, cell 3\"\r\n", writer.getBuffer().toString()); } @@ -52,10 +52,10 @@ writer, new BeanInstructionsImpl(BeanWithMultipleStrings.class) client.writeBeans(beans); writer.close(); assertEquals( - "\"beta\";\"alpha\"\r"+ - "\"row 1, cell 2\";\"row 1, cell 3\"\r"+ - "\"row 2, cell 2\";\"row 2, cell 3\"\r"+ - "\"row 3, cell 2\";\"row 3, cell 3\"\r", + "\"beta\";\"alpha\"\r\n"+ + "\"row 1, cell 2\";\"row 1, cell 3\"\r\n"+ + "\"row 2, cell 2\";\"row 2, cell 3\"\r\n"+ + "\"row 3, cell 2\";\"row 3, cell 3\"\r\n", writer.getBuffer().toString()); } @@ -84,9 +84,9 @@ public void readAndWriteRows() throws IOException { writer.close(); assertEquals( - "\"alpha\";\"beta\";\"gamma\"\r"+ - "\"row 1, cell 1\";\"row 1, cell 2\";\"row 1, cell 3\"\r"+ - "\"row 2, cell 1\";\"row 2, cell 2\";\"row 2, cell 3\"\r", + "\"alpha\";\"beta\";\"gamma\"\r\n"+ + "\"row 1, cell 1\";\"row 1, cell 2\";\"row 1, cell 3\"\r\n"+ + "\"row 2, cell 1\";\"row 2, cell 2\";\"row 2, cell 3\"\r\n", writer.getBuffer().toString()); } @@ -97,7 +97,7 @@ public void writeRow() throws IOException { .setUseHeader(false); csvClient.writeRow(new String[] { "alpha", "beta", "gamma" } ); writer.close(); - assertEquals("\"alpha\";\"beta\";\"gamma\"\r", writer.getBuffer().toString()); + assertEquals("\"alpha\";\"beta\";\"gamma\"\r\n", writer.getBuffer().toString()); } @Test @@ -115,10 +115,10 @@ public void writeRows() throws IOException { } ); writer.close(); assertEquals( - "\"h1\";\"h2\";\"h3\"\r"+ - "\"l1c1\";\"l1c2\";\"l1c3\"\r"+ - "\"l2c1\";\"l2c2\";\"l2c3\"\r"+ - "\"l3c1\";\"l3c2\";\"l3c3\"\r", + "\"h1\";\"h2\";\"h3\"\r\n"+ + "\"l1c1\";\"l1c2\";\"l1c3\"\r\n"+ + "\"l2c1\";\"l2c2\";\"l2c3\"\r\n"+ + "\"l3c1\";\"l3c2\";\"l3c3\"\r\n", writer.getBuffer().toString()); } diff --git a/src/test/java/org/csveed/bean/BeanWriterTest.java b/src/test/java/org/csveed/bean/BeanWriterTest.java index 21ef4a7e..d472bc40 100644 --- a/src/test/java/org/csveed/bean/BeanWriterTest.java +++ b/src/test/java/org/csveed/bean/BeanWriterTest.java @@ -24,10 +24,10 @@ public void writeBeans() throws IOException { beanWriter.writeBeans(beans); writer.close(); assertEquals( - "\"gamma\";\"beta\";\"alpha\"\r"+ - "\"row 1, cell 1\";\"row 1, cell 2\";\"row 1, cell 3\"\r"+ - "\"row 2, cell 1\";\"row 2, cell 2\";\"row 2, cell 3\"\r"+ - "\"row 3, cell 1\";\"row 3, cell 2\";\"row 3, cell 3\"\r", + "\"gamma\";\"beta\";\"alpha\"\r\n"+ + "\"row 1, cell 1\";\"row 1, cell 2\";\"row 1, cell 3\"\r\n"+ + "\"row 2, cell 1\";\"row 2, cell 2\";\"row 2, cell 3\"\r\n"+ + "\"row 3, cell 1\";\"row 3, cell 2\";\"row 3, cell 3\"\r\n", writer.getBuffer().toString()); } diff --git a/src/test/java/org/csveed/row/RowWriterTest.java b/src/test/java/org/csveed/row/RowWriterTest.java index faa7b628..9c412d05 100644 --- a/src/test/java/org/csveed/row/RowWriterTest.java +++ b/src/test/java/org/csveed/row/RowWriterTest.java @@ -33,9 +33,9 @@ public void readAndWrite() throws IOException { writer.close(); assertEquals( - "\"alpha\";\"beta\";\"gamma\"\r"+ - "\"row 1, cell 1\";\"row 1, cell 2\";\"row 1, cell 3\"\r"+ - "\"row 2, cell 1\";\"row 2, cell 2\";\"row 2, cell 3\"\r", + "\"alpha\";\"beta\";\"gamma\"\r\n"+ + "\"row 1, cell 1\";\"row 1, cell 2\";\"row 1, cell 3\"\r\n"+ + "\"row 2, cell 1\";\"row 2, cell 2\";\"row 2, cell 3\"\r\n", writer.getBuffer().toString()); } @@ -52,10 +52,10 @@ public void writeMultipleRows() throws IOException { }); writer.close(); assertEquals( - "\"desc1\";\"desc2\";\"desc3\"\r"+ - "\"alpha\";\"beta\";\"gamma\"\r"+ - "\"delta\";\"epsilon\";\"phi\"\r"+ - "\"b1\";\"b2\";\"b3\"\r", + "\"desc1\";\"desc2\";\"desc3\"\r\n"+ + "\"alpha\";\"beta\";\"gamma\"\r\n"+ + "\"delta\";\"epsilon\";\"phi\"\r\n"+ + "\"b1\";\"b2\";\"b3\"\r\n", writer.getBuffer().toString()); } @@ -68,7 +68,7 @@ public void writeRowWithEscapeCharacters() throws IOException { RowWriter rowWriter = new RowWriterImpl(writer, instructions); rowWriter.writeRow(new String[] { "\"tekst met \"quotes\"\"" } ); writer.close(); - assertEquals("\"\\\"tekst met \\\"quotes\\\"\\\"\"\r", writer.getBuffer().toString()); + assertEquals("\"\\\"tekst met \\\"quotes\\\"\\\"\"\r\n", writer.getBuffer().toString()); } @Test @@ -79,7 +79,7 @@ public void writeRow() throws IOException { RowWriter rowWriter = new RowWriterImpl(writer, instructions); rowWriter.writeRow(new String[] { "alpha", "beta", "gamma" } ); writer.close(); - assertEquals("\"alpha\";\"beta\";\"gamma\"\r", writer.getBuffer().toString()); + assertEquals("\"alpha\";\"beta\";\"gamma\"\r\n", writer.getBuffer().toString()); } @Test @@ -90,8 +90,8 @@ public void writeRowAndHeader() throws IOException { rowWriter.writeRow(new String[] { "alpha", "beta", "gamma" } ); writer.close(); assertEquals( - "\"desc1\";\"desc2\";\"desc3\"\r"+ - "\"alpha\";\"beta\";\"gamma\"\r", + "\"desc1\";\"desc2\";\"desc3\"\r\n"+ + "\"alpha\";\"beta\";\"gamma\"\r\n", writer.getBuffer().toString()); }