Skip to content
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

MCR-3302 fix edge cases for MCRCategoryID.fromString() #2327

Open
wants to merge 2 commits into
base: 2023.06.x
Choose a base branch
from

Conversation

yagee-de
Copy link
Member

Link to jira.

This pull request includes several changes to improve the handling of category IDs and update the testing framework in the mycore-base module. The most important changes include adding a new JUnit dependency, refactoring the fromString method in MCRCategoryID, and updating the tests to use JUnit 5.

Dependency Updates:

  • Added junit-jupiter-params dependency to pom.xml for parameterized tests.

Code Refactoring:

  • Refactored fromString method in MCRCategoryID to use split and switch instead of StringTokenizer for better readability and error handling.
  • Removed unused import StringTokenizer from MCRCategoryID.java.

Testing Updates:

  • Updated test class MCRCategoryIDTest to use JUnit 5 annotations and methods, including assertThrows for exception testing. [1] [2]
  • Added parameterized tests for invalid category ID edge cases in MCRCategoryIDTest.

Choose a reason for hiding this comment

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

Copilot reviewed 2 out of 3 changed files in this pull request and generated no suggestions.

Files not reviewed (1)
  • mycore-base/pom.xml: Language not supported
Comments skipped due to low confidence (2)

mycore-base/src/main/java/org/mycore/datamodel/classifications2/MCRCategoryID.java:99

  • [nitpick] The error message 'CategoryId is ambiguous' is unclear. Consider changing it to 'CategoryId format is invalid or ambiguous: ' + categoryId.
default -> throw new IllegalArgumentException("CategoryId is ambiguous: " + categoryId);

mycore-base/src/main/java/org/mycore/datamodel/classifications2/MCRCategoryID.java:30

  • There is a spelling mistake in the error message: 'chracters' should be 'characters'.
classification ID ''%s'' is more than %d chracters long: %d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant