-
-
Notifications
You must be signed in to change notification settings - Fork 3k
changed ISSNCleanup into NormalizeIssn, refactored respective tests #13748 #13767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
koppor
merged 6 commits into
JabRef:main
from
siddhantkore:refactor-ISSNCleanup-into-NormalizeIssn
Sep 3, 2025
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7a30c30
changed ISSNCleanup into NormalizeIssn, refactored respective tests
siddhantkore c3687be
fixed earlier failure and fixed style
siddhantkore 7bcfe62
fixed style(fixes #13748)
siddhantkore 4b2452d
Merge remote-tracking branch 'upstream/main' into refactor-ISSNCleanu…
siddhantkore ccda2f9
Refactor: Normalize ISSN with @NonNull, parameterized tests
siddhantkore 1122be9
Apply OpenRewrite cleanup to NormalizeIssnTest
siddhantkore File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
29 changes: 0 additions & 29 deletions
29
jablib/src/main/java/org/jabref/logic/cleanup/ISSNCleanup.java
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
44 changes: 44 additions & 0 deletions
44
jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeIssn.java
This file contains hidden or 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,44 @@ | ||
package org.jabref.logic.formatter.bibtexfields; | ||
|
||
import org.jabref.logic.cleanup.Formatter; | ||
import org.jabref.logic.l10n.Localization; | ||
import org.jabref.model.entry.identifier.ISSN; | ||
|
||
import org.jspecify.annotations.NonNull; | ||
|
||
public class NormalizeIssn extends Formatter { | ||
|
||
@Override | ||
public String getName() { | ||
return Localization.lang("Normalize ISSN"); | ||
} | ||
|
||
@Override | ||
public String getKey() { | ||
return "normalize_issn"; | ||
} | ||
|
||
@Override | ||
public String format(@NonNull String value) { | ||
if (value.isBlank()) { | ||
return value; | ||
} | ||
|
||
ISSN issn = new ISSN(value); | ||
|
||
if (issn.isCanBeCleaned()) { | ||
return issn.getCleanedISSN(); | ||
} | ||
return value; | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return "Normalizes ISSNs by ensuring they contain a dash (e.g., 12345678 → 1234-5678)"; | ||
} | ||
|
||
@Override | ||
public String getExampleInput() { | ||
return "12345678"; | ||
} | ||
} |
This file contains hidden or 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 hidden or 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
58 changes: 0 additions & 58 deletions
58
jablib/src/test/java/org/jabref/logic/cleanup/ISSNCleanupTest.java
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
jablib/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizeIssnTest.java
This file contains hidden or 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,22 @@ | ||
package org.jabref.logic.formatter.bibtexfields; | ||
|
||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.CsvSource; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
class NormalizeISSNTest { | ||
|
||
private final NormalizeIssn formatISSN = new NormalizeIssn(); | ||
|
||
@ParameterizedTest | ||
@CsvSource({ | ||
"0123-4567, 0123-4567", | ||
"01234567, 0123-4567", | ||
"Banana, Banana", | ||
"'',''" | ||
}) | ||
void issnFormatting(String input, String expected) { | ||
assertEquals(expected, formatISSN.format(input)); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test data should use Arguments.of() instead of @CsvSource for better readability and maintainability in JUnit tests, following modern Java practices.