-
-
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.
- Loading branch information
Showing
20 changed files
with
89 additions
and
50 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1707,4 +1707,5 @@ Custom= | |
|
||
Converts_HTML_code_to_Unicode.= | ||
|
||
Add_possibly_missing_dash_to_ISSN= | ||
|
||
Reformat_ISSN= |
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 |
---|---|---|
|
@@ -2425,4 +2425,5 @@ Custom= | |
|
||
|
||
|
||
Add_possibly_missing_dash_to_ISSN= | ||
|
||
Reformat_ISSN= |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1609,4 +1609,5 @@ Custom= | |
|
||
Converts_HTML_code_to_Unicode.= | ||
|
||
Add_possibly_missing_dash_to_ISSN= | ||
|
||
Reformat_ISSN= |
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 |
---|---|---|
|
@@ -2395,4 +2395,5 @@ Custom= | |
|
||
Converts_HTML_code_to_Unicode.= | ||
|
||
Add_possibly_missing_dash_to_ISSN= | ||
|
||
Reformat_ISSN= |
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 |
---|---|---|
|
@@ -1653,4 +1653,5 @@ Custom= | |
|
||
Converts_HTML_code_to_Unicode.= | ||
|
||
Add_possibly_missing_dash_to_ISSN= | ||
|
||
Reformat_ISSN= |
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 |
---|---|---|
|
@@ -1628,4 +1628,5 @@ Custom= | |
|
||
Converts_HTML_code_to_Unicode.= | ||
|
||
Add_possibly_missing_dash_to_ISSN= | ||
|
||
Reformat_ISSN= |
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 |
---|---|---|
|
@@ -1728,4 +1728,5 @@ Custom= | |
|
||
Converts_HTML_code_to_Unicode.= | ||
|
||
Add_possibly_missing_dash_to_ISSN= | ||
|
||
Reformat_ISSN= |
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 |
---|---|---|
|
@@ -2373,4 +2373,5 @@ Custom= | |
|
||
Converts_HTML_code_to_Unicode.= | ||
|
||
Add_possibly_missing_dash_to_ISSN= | ||
|
||
Reformat_ISSN= |
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 |
---|---|---|
|
@@ -2404,4 +2404,5 @@ Custom= | |
|
||
Converts_HTML_code_to_Unicode.= | ||
|
||
Add_possibly_missing_dash_to_ISSN= | ||
|
||
Reformat_ISSN= |
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 |
---|---|---|
|
@@ -2800,4 +2800,5 @@ Custom= | |
|
||
Converts_HTML_code_to_Unicode.= | ||
|
||
Add_possibly_missing_dash_to_ISSN= | ||
|
||
Reformat_ISSN= |
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 |
---|---|---|
|
@@ -1622,4 +1622,5 @@ Custom= | |
|
||
Converts_HTML_code_to_Unicode.= | ||
|
||
Add_possibly_missing_dash_to_ISSN= | ||
|
||
Reformat_ISSN= |
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 |
---|---|---|
|
@@ -2372,4 +2372,5 @@ Custom= | |
|
||
Converts_HTML_code_to_Unicode.= | ||
|
||
Add_possibly_missing_dash_to_ISSN= | ||
|
||
Reformat_ISSN= |
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 |
---|---|---|
|
@@ -1565,4 +1565,5 @@ Custom=Egna | |
|
||
|
||
|
||
Add_possibly_missing_dash_to_ISSN= | ||
|
||
Reformat_ISSN= |
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 |
---|---|---|
|
@@ -1641,4 +1641,5 @@ Custom= | |
|
||
Converts_HTML_code_to_Unicode.= | ||
|
||
Add_possibly_missing_dash_to_ISSN= | ||
|
||
Reformat_ISSN= |
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 |
---|---|---|
|
@@ -2396,4 +2396,5 @@ Custom= | |
|
||
Converts_HTML_code_to_Unicode.= | ||
|
||
Add_possibly_missing_dash_to_ISSN= | ||
|
||
Reformat_ISSN= |
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 |
---|---|---|
|
@@ -1635,4 +1635,5 @@ Custom= | |
|
||
Converts_HTML_code_to_Unicode.= | ||
|
||
Add_possibly_missing_dash_to_ISSN= | ||
|
||
Reformat_ISSN= |
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
55 changes: 55 additions & 0 deletions
55
src/test/java/net/sf/jabref/logic/cleanup/ISSNCleanupTest.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,55 @@ | ||
package net.sf.jabref.logic.cleanup; | ||
|
||
import java.util.Optional; | ||
|
||
import net.sf.jabref.BibDatabaseContext; | ||
import net.sf.jabref.logic.journals.JournalAbbreviationLoader; | ||
import net.sf.jabref.model.entry.BibEntry; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import static org.mockito.Mockito.mock; | ||
|
||
public class ISSNCleanupTest { | ||
|
||
private CleanupWorker worker; | ||
|
||
|
||
@Before | ||
public void setUp() { | ||
worker = new CleanupWorker(mock(BibDatabaseContext.class), mock(JournalAbbreviationLoader.class)); | ||
} | ||
|
||
@Test | ||
public void cleanupISSNReturnsCorrectISSN() { | ||
CleanupPreset preset = new CleanupPreset(CleanupPreset.CleanupStep.CLEAN_UP_ISSN); | ||
BibEntry entry = new BibEntry(); | ||
entry.setField("issn", "0123-4567"); | ||
|
||
worker.cleanup(preset, entry); | ||
Assert.assertEquals(Optional.of("0123-4567"), entry.getFieldOptional("issn")); | ||
} | ||
|
||
@Test | ||
public void cleanupISSNAddsMissingDash() { | ||
CleanupPreset preset = new CleanupPreset(CleanupPreset.CleanupStep.CLEAN_UP_ISSN); | ||
BibEntry entry = new BibEntry(); | ||
entry.setField("issn", "01234567"); | ||
|
||
worker.cleanup(preset, entry); | ||
Assert.assertEquals(Optional.of("0123-4567"), entry.getFieldOptional("issn")); | ||
} | ||
|
||
@Test | ||
public void cleanupISSNJunkStaysJunk() { | ||
CleanupPreset preset = new CleanupPreset(CleanupPreset.CleanupStep.CLEAN_UP_ISSN); | ||
BibEntry entry = new BibEntry(); | ||
entry.setField("issn", "Banana"); | ||
|
||
worker.cleanup(preset, entry); | ||
Assert.assertEquals(Optional.of("Banana"), entry.getFieldOptional("issn")); | ||
} | ||
|
||
} |