This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository nuiton-csv. See https://gitlab.nuiton.org/nuiton/nuiton-csv.git commit 8d5d8e196fe31d6946815d5ef8f9f4dd48b48f86 Author: Arnaud Thimel <thimel@codelutin.com> Date: Wed May 2 16:01:47 2018 +0200 refs #4 Add unit test on import only --- src/test/java/org/nuiton/csv/ImportExportTest.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/test/java/org/nuiton/csv/ImportExportTest.java b/src/test/java/org/nuiton/csv/ImportExportTest.java index 7f0016f..f9f7816 100644 --- a/src/test/java/org/nuiton/csv/ImportExportTest.java +++ b/src/test/java/org/nuiton/csv/ImportExportTest.java @@ -134,6 +134,24 @@ public class ImportExportTest { } + @Test + public void testImportDoubleQuotesString() throws Exception { + + String csv = "DATE;TITLE;NUMBER;ROWBEANENUM;BOOLS\n" + + "2018-05-02;Un singe en été;24;TWO;false\n" + + "2018-05-02;\"Amazing\" spiderman;42;ZERO;true"; + + List<RowBean> imported = importContent(importExportModel, csv); + + // Import doesn't fail, BUT as the CSV value is not correctly formatted, we accept that the double quotes + // overtakes the full value, thus we accept that the title is "Amazing" only + Assert.assertEquals("Amazing", imported.get(1).getTitle()); + + // XXX AThimel 02/05/2018 This behavior might change in the future which means the next test will be valid + // Assert.assertEquals(""Amazing" spiderman", imported.get(1).getTitle()); + + } + protected List<RowBean> importContent(ImportModel<RowBean> model, String content) throws IOException { Reader reader = new StringReader(content); -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.