-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Christoph <siedlerkiller@gmail.com>
- Loading branch information
1 parent
4572ab5
commit 2d680ab
Showing
6 changed files
with
101 additions
and
7 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
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
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
66 changes: 66 additions & 0 deletions
66
src/test/java/org/jabref/logic/cleanup/DoiDecodeCleanupTest.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,66 @@ | ||
package org.jabref.logic.cleanup; | ||
|
||
import java.util.stream.Stream; | ||
|
||
import org.jabref.model.entry.BibEntry; | ||
import org.jabref.model.entry.field.StandardField; | ||
import org.jabref.model.entry.field.UnknownField; | ||
|
||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.Arguments; | ||
import org.junit.jupiter.params.provider.MethodSource; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class DoiDecodeCleanupTest { | ||
|
||
@ParameterizedTest | ||
@MethodSource("provideDoiForAllLowers") | ||
public void testChangeDoi(BibEntry expected, BibEntry doiInfoField) { | ||
DoiCleanup cleanUp = new DoiCleanup(); | ||
cleanUp.cleanup(doiInfoField); | ||
|
||
assertEquals(expected, doiInfoField); | ||
} | ||
|
||
private static Stream<Arguments> provideDoiForAllLowers() { | ||
UnknownField unknownField = new UnknownField("ee"); | ||
BibEntry doiResult = new BibEntry().withField(StandardField.DOI, "10.18726/2018_3"); | ||
|
||
return Stream.of( | ||
// cleanup for Doi field only | ||
Arguments.of(doiResult, new BibEntry().withField( | ||
StandardField.URL, "https://doi.org/10.18726/2018%7B%5Ctextunderscore%7D3")), | ||
|
||
// cleanup with Doi and URL to all entries | ||
Arguments.of(doiResult, new BibEntry() | ||
.withField(StandardField.DOI, "10.18726/2018%7B%5Ctextunderscore%7D3") | ||
.withField(StandardField.URL, "https://doi.org/10.18726/2018%7B%5Ctextunderscore%7D3") | ||
.withField(StandardField.NOTE, "https://doi.org/10.18726/2018%7B%5Ctextunderscore%7D3") | ||
.withField(unknownField, "https://doi.org/10.18726/2018%7B%5Ctextunderscore%7D3")), | ||
|
||
// cleanup with Doi and no URL to entries | ||
Arguments.of( | ||
new BibEntry() | ||
.withField(StandardField.DOI, "10.18726/2018_3") | ||
.withField(StandardField.NOTE, "This is a random note to this Doi") | ||
.withField(unknownField, "This is a random ee field for this Doi"), | ||
new BibEntry() | ||
.withField(StandardField.DOI, "10.18726/2018_3") | ||
.withField(StandardField.NOTE, "This is a random note to this Doi") | ||
.withField(unknownField, "This is a random ee field for this Doi")), | ||
|
||
// cleanup with spaced Doi | ||
Arguments.of(doiResult, new BibEntry() | ||
.withField(StandardField.DOI, "10.18726/2018%7B%5Ctextunderscore%7D3")), | ||
|
||
// cleanup just Note field with URL | ||
Arguments.of(doiResult, new BibEntry() | ||
.withField(StandardField.NOTE, "https://doi.org/10.18726/2018%7B%5Ctextunderscore%7D3")), | ||
|
||
// cleanup just ee field with URL | ||
Arguments.of(doiResult, new BibEntry() | ||
.withField(unknownField, "https://doi.org/10.18726/2018%7B%5Ctextunderscore%7D3")) | ||
); | ||
} | ||
} |