branch develop updated (8d5d8e1 -> 7845ed7)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository nuiton-csv. See https://gitlab.nuiton.org/nuiton/nuiton-csv.git from 8d5d8e1 refs #4 Add unit test on import only new 7845ed7 Utilisation de try-with-ressources The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 7845ed7cbb1ad4f827e87a4330548ad31834a686 Author: Arnaud Thimel <thimel@codelutin.com> Date: Wed May 2 16:08:06 2018 +0200 Utilisation de try-with-ressources Summary of changes: src/test/java/org/nuiton/csv/ImportExportTest.java | 21 +++++++----------- src/test/java/org/nuiton/csv/ImportTest.java | 25 +++++++++------------- 2 files changed, 18 insertions(+), 28 deletions(-) -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
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 7845ed7cbb1ad4f827e87a4330548ad31834a686 Author: Arnaud Thimel <thimel@codelutin.com> Date: Wed May 2 16:08:06 2018 +0200 Utilisation de try-with-ressources --- src/test/java/org/nuiton/csv/ImportExportTest.java | 21 +++++++----------- src/test/java/org/nuiton/csv/ImportTest.java | 25 +++++++++------------- 2 files changed, 18 insertions(+), 28 deletions(-) diff --git a/src/test/java/org/nuiton/csv/ImportExportTest.java b/src/test/java/org/nuiton/csv/ImportExportTest.java index f9f7816..96dca1a 100644 --- a/src/test/java/org/nuiton/csv/ImportExportTest.java +++ b/src/test/java/org/nuiton/csv/ImportExportTest.java @@ -154,20 +154,15 @@ public class ImportExportTest { protected List<RowBean> importContent(ImportModel<RowBean> model, String content) throws IOException { - Reader reader = new StringReader(content); - try { - Import2<RowBean> rowImport = Import2.newImport(model, reader); - try { - List<RowBean> result = new ArrayList<>(); - for (ImportRow<RowBean> row : rowImport) { - result.add(row.getBean()); - } - return result; - } finally { - rowImport.close(); + try ( + Reader reader = new StringReader(content); + Import2<RowBean> rowImport = Import2.newImport(model, reader) + ){ + List<RowBean> result = new ArrayList<>(); + for (ImportRow<RowBean> row : rowImport) { + result.add(row.getBean()); } - } finally { - reader.close(); + return result; } } diff --git a/src/test/java/org/nuiton/csv/ImportTest.java b/src/test/java/org/nuiton/csv/ImportTest.java index 22f0acc..97c0c35 100644 --- a/src/test/java/org/nuiton/csv/ImportTest.java +++ b/src/test/java/org/nuiton/csv/ImportTest.java @@ -77,7 +77,6 @@ public class ImportTest { return (Iterable) modelBuilder.getColumnsForExport(); } }, rows, Charset.forName("UTF-8")); - System.out.println(csv); // import as string rows = importContent(new AbstractImportModel<RowBean>(';') { @@ -157,20 +156,16 @@ public class ImportTest { protected List<RowBean> importContent(ImportModel<RowBean> model, String content) throws IOException { - Reader reader = new StringReader(content); - try { - Import<RowBean> rowImport = Import.newImport(model, reader); - try { - List<RowBean> result = new ArrayList<>(); - for (RowBean row : rowImport) { - result.add(row); - } - return result; - } finally { - rowImport.close(); + + try ( + Reader reader = new StringReader(content); + Import<RowBean> rowImport = Import.newImport(model, reader) + ) { + List<RowBean> result = new ArrayList<>(); + for (RowBean row : rowImport) { + result.add(row); } - } finally { - reader.close(); + return result; } } @@ -440,4 +435,4 @@ public class ImportTest { throws Exception; } -} // $Id$ +} -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm