Fix for issue 2762: Change CSV export to separate all names using semicolon#2793
Conversation
Add LayoutFormatter AuthorAndToSemicolonReplacer that replaces all " and " with "; ". This formatter is used to format authors and editors for the openoffice-csv layout.
| assertEquals(4, lines.size()); | ||
| System.out.println(lines.get(3)); | ||
| assertTrue(lines.get(1).matches("^.*,\"Someone, Van Something\",.*$")); | ||
| assertTrue(lines.get(2).matches("^.*,\"von Neumann, John; Smith, John; Black Brown, Peter\",.*$")); |
There was a problem hiding this comment.
Maybe you can separate this into three test. One for a single author, one for two and the last for N multiples.
| Assert.assertEquals("Someone, Van Something", a.format("Someone, Van Something")); | ||
|
|
||
| // Two names just one semicolon | ||
| Assert.assertEquals("John Smith; Black Brown, Peter", a |
There was a problem hiding this comment.
Please separate to multiple tests as suggested above. One for each test case.
tobiasdiez
left a comment
There was a problem hiding this comment.
I only have a few small remarks. Can be merged when these are fixed.
| - Continued to redesign the user interface: this time the editor got a fresh coat of paint: | ||
| - The buttons were changed to icons. | ||
| - Removed the hidden feature that a double click in the editor inserted the current date. | ||
| - All authors and editors are separated using semicolons when exporting to csv. |
There was a problem hiding this comment.
Please add a reference to the fixed issue (see the changelog entries below).
There was a problem hiding this comment.
Should I move this entry to the section Fixed or keep it under Changes?
There was a problem hiding this comment.
You can leave it there for the moment. Before a new version release we usually check and reorder the changelog
| List<String> lines = Files.readAllLines(tmpFile.toPath()); | ||
| assertEquals(4, lines.size()); | ||
| System.out.println(lines.get(3)); | ||
| assertTrue(lines.get(1).matches("^.*,\"Someone, Van Something\",.*$")); |
There was a problem hiding this comment.
It is probably better to replace the assertTrue with something like assertEquals("mykey1; title1; Someone, Van Something", lines.get(1))
|
Thanks for the quick follow-up and I really like the solution with paramaterized tests (and the fact that you wrote tests in the first place!). |
* upstream/master: (84 commits) Update README.md Update CHANGELOG.md Fixes #2789 Add Referer to API call (#2794) Change some FileDialogs to DialogService (#2767) Fix for issue 2762: Change CSV export to separate all names using semicolon (#2793) Set eclipse line wrapping to maximum Do not log an exception if side pane was not found (#2791) Added 'Ink' to the supported FileAnnotationType (required to close #2777) Renamed parseFileAnnotationType() to parse() Reimplement date editor in JavaFX (#2781) Update CONTRIBUTING.md Add new author Fixes handling of unknown PDAnnotation types. Update Checkstyle Version fix some more checkstyle warnings fix some more checkstyle warnings Fix Build failure, hopefully Spanish translation (#2773) Fixes #2766 If file is not found annotations might be null Fix language tests ... # Conflicts: # src/main/java/org/jabref/logic/util/io/FileUtil.java
See #2762
Added a new LayoutFormatter that replaces all occurrences of " and " in the fieldText with "; ".
This formatter is now used for the author and editor fields when exporting to a csv file.