Skip to content

changed ISSNCleanup into NormalizeIssn, refactored respective tests #13748#13767

Merged
koppor merged 6 commits intoJabRef:mainfrom
siddhantkore:refactor-ISSNCleanup-into-NormalizeIssn
Sep 3, 2025
Merged

changed ISSNCleanup into NormalizeIssn, refactored respective tests #13748#13767
koppor merged 6 commits intoJabRef:mainfrom
siddhantkore:refactor-ISSNCleanup-into-NormalizeIssn

Conversation

@siddhantkore
Copy link
Copy Markdown
Contributor

@siddhantkore siddhantkore commented Aug 27, 2025

Closes #13748
This PR moves ISSNCleanup int NormalizeIssn Issn formatter

Changes

  • Moved ISSNCleanupNormalizeIssn in org.jabref.logic.formatter.bibtexfields.
  • NormalizeIssn now extends Formatter (instead of CleanupJob).
  • Removed CLEAN_UP_ISSN from CleanupWorker and CleanupPresetPanel.
  • Updated CleanupPresetPanel.fxml to fix indentation and remove the ISSN checkbox.
  • Added unit test NormalizeIssnTest refactored ISSNCleanupTest

Steps to test

12345678 ISSN is normalized to 1234-5678.
1234-5678 ISSN remains unchanged.
ISSN cleanup option is no longer shown.

Mandatory checks

import org.jabref.logic.formatter.bibtexfields.NormalizePagesFormatter;
import org.jabref.logic.formatter.bibtexfields.OrdinalsToSuperscriptFormatter;
import org.jabref.logic.formatter.bibtexfields.UnicodeToLatexFormatter;
import org.jabref.logic.formatter.bibtexfields.*;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very nice. 👍

Only two nitpicks.


@Override
public String format(String value) {
Objects.requireNonNull(value);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use @NonNull annotation instead of requireNonNull

new ReplaceUnicodeLigaturesFormatter(),
new UnprotectTermsFormatter()
new UnprotectTermsFormatter(),
new NormalizeIssn()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to "Normalize*" Group (even though it is not really alphabetically sorted

Please move the NormalizeUnicodeFormater also up.

@Test
void emptyOrNullReturnsSame() {
assertEquals("", formatISSN.format(""));
assertThrows(NullPointerException.class, () -> formatISSN.format(null));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line can be removed if we change to JSpecify

Comment on lines +12 to +25
@Test
void returnValidIssnUnchanged() {
assertEquals("0123-4567", formatISSN.format("0123-4567"));
}

@Test
void addMissingDashToIssn() {
assertEquals("0123-4567", formatISSN.format("01234567"));
}

@Test
void leavesInvalidInputUnchanged() {
assertEquals("Banana", formatISSN.format("Banana"));
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please convert to @ParamterizedTest. You can use @CsvSource

@koppor koppor added the status: changes-required Pull requests that are not yet complete label Aug 28, 2025
Comment on lines +13 to +18
@CsvSource({
"0123-4567, 0123-4567",
"01234567, 0123-4567",
"Banana, Banana",
"'',''"
})
Copy link
Copy Markdown

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.

@siddhantkore
Copy link
Copy Markdown
Contributor Author

Hey @koppor , this is my first contribution.
I feel this PR got a bit messy. If any suggestion, improvement for me please let me know.
Thanks.

@siddhantkore siddhantkore requested a review from koppor September 1, 2025 07:36
@koppor koppor added this pull request to the merge queue Sep 3, 2025
Merged via the queue into JabRef:main with commit b8b3e87 Sep 3, 2025
2 checks passed
Siedlerchr added a commit that referenced this pull request Sep 8, 2025
* upstream/main: (54 commits)
  Split relativizeSymlinks parameterized tests in separate tests (#13782)
  Update the search syntax highlight for web search (#13801)
  Chore(deps): Bump ai.djl:bom from 0.33.0 to 0.34.0 in /versions (#13833)
  Fix typos in CHANGELOG.md (#13826)
  Chore(deps): Bump com.konghq:unirest-modules-gson in /versions (#13831)
  Chore(deps): Bump org.gradlex:extra-java-module-info in /build-logic (#13830)
  Chore(deps): Bump org.apache.logging.log4j:log4j-to-slf4j in /versions (#13832)
  Chore(deps): Bump io.zonky.test.postgres:embedded-postgres-binaries-bom (#13834)
  Chore(deps): Bump jablib/src/main/resources/csl-locales (#13829)
  Chore(deps): Bump jablib/src/main/resources/csl-styles (#13827)
  Chore(deps): Bump jablib/src/main/abbrv.jabref.org (#13828)
  add: CAYW endpoint formats (#13785)
  New Crowdin updates (#13823)
  chore(deps): update dependency org.kohsuke:github-api to v2.0-rc.5 (#13822)
  Add support for automatic ICORE conference ranking lookup [#13476] (#13699)
  New Crowdin updates (#13820)
  Initialize search bar auto-completion with real database context (no tab switch needed) (#13816)
  Fixes #13274: Allow cygwin-paths on Windows (#13297)
  Refine "REDACTED" replacement of API key value in web fetcher search URL (#13814)
  changed ISSNCleanup into NormalizeIssn, refactored respective tests #13748 (#13767)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: changes-required Pull requests that are not yet complete

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make ISSNCleanup a Formatter

2 participants