forked from JabRef/jabref
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix file field merging (JabRef#10573)
Add test Fixes JabRef#10572
- Loading branch information
1 parent
f6334e9
commit 956e9f6
Showing
3 changed files
with
40 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/test/java/org/jabref/gui/mergeentries/newmergedialog/fieldsmerger/FileMergerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.jabref.gui.mergeentries.newmergedialog.fieldsmerger; | ||
|
||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.CsvSource; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
class FileMergerTest { | ||
FileMerger fileMerger = new FileMerger(); | ||
|
||
/** | ||
* Test the following cases | ||
* nullvalues | ||
* emptyString for FileB | ||
* emptyString for FileA | ||
* FileA and FileB are valid strings and are separated by semicolon | ||
* | ||
* @param expect Expected value | ||
* @param fileA File string a | ||
* @param fileB File String b | ||
*/ | ||
@ParameterizedTest | ||
@CsvSource(textBlock = """ | ||
,,, | ||
FileA,FileA, | ||
FileA,FileA,'' | ||
FileB, ,FileB | ||
FileB,'',FileB | ||
:A2012 -A.pdf:PDF;B2013 - B.pdf:PDF:,:A2012 -A.pdf:PDF,B2013 - B.pdf:PDF | ||
:A2012 -A.pdf:;B2013 - B.pdf:PDF:,A2012 -A.pdf,B2013 - B.pdf:PDF | ||
:A2012 -A.pdf:;:asdf:,A2012 -A.pdf,asdf | ||
""") | ||
void testMerge(String expect, String fileA, String fileB) { | ||
assertEquals(expect, fileMerger.merge(fileA, fileB)); | ||
} | ||
} |