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

Migrate to AssertJ #136

Merged
merged 2 commits into from
Aug 18, 2024
Merged

Migrate to AssertJ #136

merged 2 commits into from
Aug 18, 2024

Conversation

jodastephen
Copy link
Member

@jodastephen jodastephen commented Aug 18, 2024

Summary by CodeRabbit

  • New Features

    • Introduced AssertJ as a new testing library to enhance testing capabilities.
  • Bug Fixes

    • No bug fixes were made in this release.
  • Documentation

    • Improved readability and expressiveness of test cases by transitioning to AssertJ assertions.
  • Refactor

    • Updated multiple test classes to replace JUnit assertions with AssertJ's fluent assertion style, improving maintainability and clarity.
  • Tests

    • Enhanced existing unit tests across various classes to leverage AssertJ for more descriptive assertions.

Copy link

coderabbitai bot commented Aug 18, 2024

Walkthrough

Walkthrough

The overall change involves integrating the AssertJ assertion library into the project's testing framework, replacing traditional JUnit assertions across multiple test classes. This transition enhances the readability and expressiveness of the test cases, making them more maintainable and aligned with modern testing practices. Additionally, a new dependency for AssertJ is added to the project's pom.xml, allowing for centralised version management.

Changes

Files Change Summary
pom.xml Added AssertJ dependency with version management under <properties>.
src/test/java/org/joda/money/*Test*.java Replaced JUnit assertions (assertEquals, assertTrue, etc.) with AssertJ assertions (assertThat). Enhances readability and expressiveness across all test classes.

Sequence Diagram(s)

sequenceDiagram
    participant Test as Test Classes
    participant AssertJ as AssertJ Assertions
    participant JUnit as JUnit Assertions

    Test->>JUnit: Use traditional assertions
    JUnit-->>Test: Returns assertion results

    Test->>AssertJ: Transition to fluent assertions
    AssertJ-->>Test: Returns improved assertion results
Loading

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 983b382 and b4f1813.

Files selected for processing (13)
  • pom.xml (2 hunks)
  • src/test/java/org/joda/money/TestCurrencyMismatchException.java (2 hunks)
  • src/test/java/org/joda/money/TestCurrencyUnit.java (33 hunks)
  • src/test/java/org/joda/money/TestCurrencyUnitExtension.java (5 hunks)
  • src/test/java/org/joda/money/TestIllegalCurrencyException.java (2 hunks)
  • src/test/java/org/joda/money/TestMoneyUtils_BigMoney.java (3 hunks)
  • src/test/java/org/joda/money/TestMoneyUtils_Money.java (2 hunks)
  • src/test/java/org/joda/money/TestStringConvert.java (2 hunks)
  • src/test/java/org/joda/money/format/TestMoneyAmountStyle.java (6 hunks)
  • src/test/java/org/joda/money/format/TestMoneyFormatter.java (9 hunks)
  • src/test/java/org/joda/money/format/TestMoneyFormatterBuilder.java (15 hunks)
  • src/test/java/org/joda/money/format/TestMoneyFormatterException.java (2 hunks)
  • src/test/java/org/joda/money/format/TestMoneyParseContext.java (2 hunks)
Files skipped from review due to trivial changes (6)
  • src/test/java/org/joda/money/TestCurrencyMismatchException.java
  • src/test/java/org/joda/money/TestIllegalCurrencyException.java
  • src/test/java/org/joda/money/TestStringConvert.java
  • src/test/java/org/joda/money/format/TestMoneyAmountStyle.java
  • src/test/java/org/joda/money/format/TestMoneyFormatter.java
  • src/test/java/org/joda/money/format/TestMoneyParseContext.java
Additional comments not posted (182)
src/test/java/org/joda/money/format/TestMoneyFormatterException.java (3)

18-19: Imports updated to AssertJ.

The imports have been updated to use AssertJ's assertion methods, which are more expressive and readable.


33-34: Use of assertThatExceptionOfType improves readability.

The use of assertThatExceptionOfType provides a clear and fluent way to assert that an exception is thrown, improving the readability of the test.


40-41: Use of assertThatNoException enhances clarity.

The change to assertThatNoException makes it explicit that no exception is expected, enhancing the clarity of the test's intent.

src/test/java/org/joda/money/TestCurrencyUnitExtension.java (6)

18-19: Imports updated to AssertJ.

The imports have been updated to use AssertJ's assertion methods, which are more expressive and readable.


40-40: Use of assertThat for boolean condition improves readability.

The change to assertThat(found).isTrue() provides a more expressive and readable way to assert boolean conditions.


53-53: Use of assertThat for boolean condition improves readability.

The change to assertThat(found).isTrue() provides a more expressive and readable way to assert boolean conditions.


63-63: Use of assertThat for equality check enhances clarity.

The use of assertThat(...).isEqualTo(...) provides a clearer and more fluent way to assert equality, aligning with modern testing practices.


67-67: Use of assertThat for boolean condition improves readability.

The change to assertThat(found).isTrue() provides a more expressive and readable way to assert boolean conditions.


91-93: Use of assertThat for equality and boolean conditions enhances clarity.

The use of assertThat(...).isEqualTo(...) and assertThat(...).isTrue() provides a clearer and more fluent way to assert conditions, improving readability and maintainability.

src/test/java/org/joda/money/TestMoneyUtils_Money.java (29)

18-19: Imports updated to AssertJ.

The imports have been updated to use AssertJ's assertion methods, which are more expressive and readable.


46-48: Use of assertThatExceptionOfType with withMessage improves clarity.

The use of assertThatExceptionOfType with withMessage provides a clear and fluent way to assert that an exception is thrown with a specific message, enhancing the readability of the test.


56-59: Use of assertThat for boolean conditions improves readability.

The change to assertThat(...).isTrue() and assertThat(...).isFalse() provides a more expressive and readable way to assert boolean conditions.


67-70: Use of assertThat for boolean conditions improves readability.

The change to assertThat(...).isTrue() and assertThat(...).isFalse() provides a more expressive and readable way to assert boolean conditions.


78-81: Use of assertThat for boolean conditions improves readability.

The change to assertThat(...).isTrue() and assertThat(...).isFalse() provides a more expressive and readable way to assert boolean conditions.


89-92: Use of assertThat for boolean conditions improves readability.

The change to assertThat(...).isTrue() and assertThat(...).isFalse() provides a more expressive and readable way to assert boolean conditions.


100-103: Use of assertThat for boolean conditions improves readability.

The change to assertThat(...).isTrue() and assertThat(...).isFalse() provides a more expressive and readable way to assert boolean conditions.


111-111: Use of assertThat for object identity improves clarity.

The use of assertThat(...).isSameAs(...) provides a clearer and more fluent way to assert object identity, aligning with modern testing practices.


116-116: Use of assertThat for object identity improves clarity.

The use of assertThat(...).isSameAs(...) provides a clearer and more fluent way to assert object identity, aligning with modern testing practices.


121-122: Use of assertThatExceptionOfType improves readability.

The use of assertThatExceptionOfType provides a clear and fluent way to assert that an exception is thrown, improving the readability of the test.


127-127: Use of assertThat for object identity improves clarity.

The use of assertThat(...).isSameAs(...) provides a clearer and more fluent way to assert object identity, aligning with modern testing practices.


132-132: Use of assertThat for object identity improves clarity.

The use of assertThat(...).isSameAs(...) provides a clearer and more fluent way to assert object identity, aligning with modern testing practices.


137-137: Use of assertThat for null checks improves clarity.

The use of assertThat(...).isNull() provides a clearer and more fluent way to assert null conditions, aligning with modern testing practices.


145-145: Use of assertThat for object identity improves clarity.

The use of assertThat(...).isSameAs(...) provides a clearer and more fluent way to assert object identity, aligning with modern testing practices.


150-150: Use of assertThat for object identity improves clarity.

The use of assertThat(...).isSameAs(...) provides a clearer and more fluent way to assert object identity, aligning with modern testing practices.


155-156: Use of assertThatExceptionOfType improves readability.

The use of assertThatExceptionOfType provides a clear and fluent way to assert that an exception is thrown, improving the readability of the test.


161-161: Use of assertThat for object identity improves clarity.

The use of assertThat(...).isSameAs(...) provides a clearer and more fluent way to assert object identity, aligning with modern testing practices.


166-166: Use of assertThat for object identity improves clarity.

The use of assertThat(...).isSameAs(...) provides a clearer and more fluent way to assert object identity, aligning with modern testing practices.


171-171: Use of assertThat for null checks improves clarity.

The use of assertThat(...).isNull() provides a clearer and more fluent way to assert null conditions, aligning with modern testing practices.


179-179: Use of assertThat for equality check enhances clarity.

The use of assertThat(...).isEqualTo(...) provides a clearer and more fluent way to assert equality, aligning with modern testing practices.


184-185: Use of assertThatExceptionOfType improves readability.

The use of assertThatExceptionOfType provides a clear and fluent way to assert that an exception is thrown, improving the readability of the test.


190-190: Use of assertThat for object identity improves clarity.

The use of assertThat(...).isSameAs(...) provides a clearer and more fluent way to assert object identity, aligning with modern testing practices.


195-195: Use of assertThat for object identity improves clarity.

The use of assertThat(...).isSameAs(...) provides a clearer and more fluent way to assert object identity, aligning with modern testing practices.


200-200: Use of assertThat for null checks improves clarity.

The use of assertThat(...).isNull() provides a clearer and more fluent way to assert null conditions, aligning with modern testing practices.


208-208: Use of assertThat for equality check enhances clarity.

The use of assertThat(...).isEqualTo(...) provides a clearer and more fluent way to assert equality, aligning with modern testing practices.


213-214: Use of assertThatExceptionOfType improves readability.

The use of assertThatExceptionOfType provides a clear and fluent way to assert that an exception is thrown, improving the readability of the test.


219-219: Use of assertThat for equality check enhances clarity.

The use of assertThat(...).isEqualTo(...) provides a clearer and more fluent way to assert equality, aligning with modern testing practices.


224-224: Use of assertThat for object identity improves clarity.

The use of assertThat(...).isSameAs(...) provides a clearer and more fluent way to assert object identity, aligning with modern testing practices.


229-229: Use of assertThat for null checks improves clarity.

The use of assertThat(...).isNull() provides a clearer and more fluent way to assert null conditions, aligning with modern testing practices.

src/test/java/org/joda/money/TestMoneyUtils_BigMoney.java (19)

18-19: Import AssertJ Assertions.

The imports for AssertJ assertions are correctly added, providing the necessary methods for fluent assertions.


45-45: Use AssertJ for Constructor Access Modifier Check.

The use of assertThat to check the constructor's access modifier is a good practice, improving readability.


55-58: Migrate to AssertJ for isZero Tests.

The migration to AssertJ for isZero tests enhances readability without changing the test logic.


66-69: Migrate to AssertJ for isPositive Tests.

The transition to AssertJ for isPositive tests is correctly implemented, maintaining the original logic.


77-80: Migrate to AssertJ for isPositiveOrZero Tests.

The use of AssertJ for isPositiveOrZero tests is appropriate and improves the clarity of assertions.


88-91: Migrate to AssertJ for isNegative Tests.

The migration to AssertJ for isNegative tests is well-executed, preserving the original intent.


99-102: Migrate to AssertJ for isNegativeOrZero Tests.

The use of AssertJ for isNegativeOrZero tests is correctly applied, enhancing readability.


110-110: Migrate to AssertJ for max Tests.

The migration to AssertJ for max tests is properly done, maintaining the original test logic.


120-121: Use AssertJ for Exception Testing in max Tests.

The use of assertThatExceptionOfType for exception testing in max tests improves fluency and clarity.


126-136: Migrate to AssertJ for max Null Tests.

The migration to AssertJ for max null tests is correctly implemented, preserving the original functionality.


144-149: Migrate to AssertJ for min Tests.

The transition to AssertJ for min tests is properly executed, maintaining the original test logic.


154-155: Use AssertJ for Exception Testing in min Tests.

The use of assertThatExceptionOfType for exception testing in min tests is a good practice, enhancing readability.


160-170: Migrate to AssertJ for min Null Tests.

The migration to AssertJ for min null tests is correctly done, maintaining the original functionality.


178-178: Migrate to AssertJ for add Tests.

The migration to AssertJ for add tests is well-implemented, preserving the original logic.


183-184: Use AssertJ for Exception Testing in add Tests.

The use of assertThatExceptionOfType for exception testing in add tests improves fluency and clarity.


189-199: Migrate to AssertJ for add Null Tests.

The migration to AssertJ for add null tests is properly executed, maintaining the original test logic.


207-207: Migrate to AssertJ for subtract Tests.

The transition to AssertJ for subtract tests is correctly implemented, preserving the original functionality.


212-213: Use AssertJ for Exception Testing in subtract Tests.

The use of assertThatExceptionOfType for exception testing in subtract tests enhances readability and fluency.


218-228: Migrate to AssertJ for subtract Null Tests.

The migration to AssertJ for subtract null tests is well-executed, maintaining the original logic.

src/test/java/org/joda/money/TestCurrencyUnit.java (73)

18-19: Import AssertJ Assertions.

The imports for AssertJ assertions are correctly added, providing the necessary methods for fluent assertions.


57-57: Migrate to AssertJ for registeredCurrencies Test.

The migration to AssertJ for checking if a currency is registered enhances readability and maintains the original logic.


65-68: Migrate to AssertJ for registeredCurrencies Sorted Test.

The transition to AssertJ for checking sorted registered currencies is correctly implemented, preserving the original functionality.


73-74: Use AssertJ for Exception Testing in registeredCurrency Tests.

The use of assertThatExceptionOfType for exception testing in registeredCurrency tests improves fluency and clarity.


79-80: Use AssertJ for Exception Testing in registeredCurrency Tests.

The use of assertThatExceptionOfType for exception testing in registeredCurrency tests enhances readability.


85-86: Use AssertJ for Exception Testing in registeredCurrency Tests.

The use of assertThatExceptionOfType for exception testing in registeredCurrency tests is well-implemented.


91-92: Use AssertJ for Exception Testing in registeredCurrency Tests.

The use of assertThatExceptionOfType for exception testing in registeredCurrency tests is correctly applied.


97-98: Use AssertJ for Exception Testing in registeredCurrency Tests.

The use of assertThatExceptionOfType for exception testing in registeredCurrency tests is appropriate.


103-104: Use AssertJ for Exception Testing in registeredCurrency Tests.

The use of assertThatExceptionOfType for exception testing in registeredCurrency tests enhances fluency.


109-110: Use AssertJ for Exception Testing in registeredCurrency Tests.

The use of assertThatExceptionOfType for exception testing in registeredCurrency tests improves clarity.


115-116: Use AssertJ for Exception Testing in registeredCurrency Tests.

The use of assertThatExceptionOfType for exception testing in registeredCurrency tests is well-executed.


121-122: Use AssertJ for Exception Testing in registeredCurrency Tests.

The use of assertThatExceptionOfType for exception testing in registeredCurrency tests is correctly implemented.


127-128: Use AssertJ for Exception Testing in registeredCurrency Tests.

The use of assertThatExceptionOfType for exception testing in registeredCurrency tests is appropriate.


133-134: Use AssertJ for Exception Testing in registeredCurrency Tests.

The use of assertThatExceptionOfType for exception testing in registeredCurrency tests enhances readability.


139-140: Use AssertJ for Exception Testing in registeredCurrency Tests.

The use of assertThatExceptionOfType for exception testing in registeredCurrency tests is correctly applied.


148-148: Migrate to AssertJ for registeredCurrency Valid DP Test.

The migration to AssertJ for checking valid decimal places in registered currencies is well-implemented.


153-154: Use AssertJ for Exception Testing in registeredCurrency Tests.

The use of assertThatExceptionOfType for exception testing in registeredCurrency tests is appropriate.


159-160: Use AssertJ for Exception Testing in registeredCurrency Tests.

The use of assertThatExceptionOfType for exception testing in registeredCurrency tests is correctly implemented.


165-166: Use AssertJ for Exception Testing in registeredCurrency Tests.

The use of assertThatExceptionOfType for exception testing in registeredCurrency tests enhances fluency.


171-172: Use AssertJ for Exception Testing in registeredCurrency Tests.

The use of assertThatExceptionOfType for exception testing in registeredCurrency tests improves clarity.


182-182: Migrate to AssertJ for registeredCurrencies Cross-Check Test.

The migration to AssertJ for cross-checking registered currencies is correctly implemented, maintaining the original logic.


194-196: Migrate to AssertJ for registeredCountries Test.

The migration to AssertJ for checking registered countries enhances readability and preserves the original functionality.


204-207: Migrate to AssertJ for registeredCountries Sorted Test.

The transition to AssertJ for checking sorted registered countries is well-executed, maintaining the original logic.


215-221: Migrate to AssertJ for Constants Test.

The migration to AssertJ for testing currency unit constants is correctly implemented, enhancing readability.


229-230: Use AssertJ for Exception Testing in Constructor Tests.

The use of assertThatExceptionOfType for exception testing in constructor tests is well-executed, improving fluency.


239-239: Migrate to AssertJ for of(Currency) Test.

The migration to AssertJ for testing the of(Currency) method is correctly implemented, maintaining the original logic.


244-245: Use AssertJ for Exception Testing in of(Currency) Tests.

The use of assertThatExceptionOfType for exception testing in of(Currency) tests enhances readability and fluency.


254-254: Migrate to AssertJ for of(String) Test.

The migration to AssertJ for testing the of(String) method is well-executed, preserving the original functionality.


259-260: Use AssertJ for Exception Testing in of(String) Tests.

The use of assertThatExceptionOfType for exception testing in of(String) tests is correctly implemented, enhancing readability.


265-267: Use AssertJ for Exception Testing with Message in of(String) Tests.

The use of assertThatExceptionOfType with withMessage for exception testing in of(String) tests is a good practice, improving clarity.


272-273: Use AssertJ for Exception Testing in of(String) Tests.

The use of assertThatExceptionOfType for exception testing in of(String) tests is correctly applied.


278-279: Use AssertJ for Exception Testing in of(String) Tests.

The use of assertThatExceptionOfType for exception testing in of(String) tests is appropriate.


284-285: Use AssertJ for Exception Testing in of(String) Tests.

The use of assertThatExceptionOfType for exception testing in of(String) tests enhances readability.


294-294: Migrate to AssertJ for ofNumericCode(String) Test.

The migration to AssertJ for testing the ofNumericCode(String) method is correctly implemented, maintaining the original logic.


300-306: Migrate to AssertJ for ofNumericCode(String) Tests.

The migration to AssertJ for testing the ofNumericCode(String) method is well-executed, preserving the original functionality.


312-318: Migrate to AssertJ for ofNumericCode(String) Tests.

The transition to AssertJ for testing the ofNumericCode(String) method is correctly applied, enhancing readability.


323-324: Use AssertJ for Exception Testing in ofNumericCode(String) Tests.

The use of assertThatExceptionOfType for exception testing in ofNumericCode(String) tests is well-executed, improving fluency.


329-331: Use AssertJ for Exception Testing with Message in ofNumericCode(String) Tests.

The use of assertThatExceptionOfType with withMessage for exception testing in ofNumericCode(String) tests is a good practice, enhancing clarity.


336-337: Use AssertJ for Exception Testing in ofNumericCode(String) Tests.

The use of assertThatExceptionOfType for exception testing in ofNumericCode(String) tests is correctly implemented.


342-344: Use AssertJ for Exception Testing with Message in ofNumericCode(String) Tests.

The use of assertThatExceptionOfType with withMessage for exception testing in ofNumericCode(String) tests improves readability.


349-351: Use AssertJ for Exception Testing with Message in ofNumericCode(String) Tests.

The use of assertThatExceptionOfType with withMessage for exception testing in ofNumericCode(String) tests is appropriate.


360-360: Migrate to AssertJ for ofNumericCode(int) Test.

The migration to AssertJ for testing the ofNumericCode(int) method is correctly implemented, maintaining the original logic.


366-372: Migrate to AssertJ for ofNumericCode(int) Tests.

The migration to AssertJ for testing the ofNumericCode(int) method is well-executed, preserving the original functionality.


377-379: Use AssertJ for Exception Testing with Message in ofNumericCode(int) Tests.

The use of assertThatExceptionOfType with withMessage for exception testing in ofNumericCode(int) tests is a good practice, enhancing clarity.


384-386: Use AssertJ for Exception Testing with Message in ofNumericCode(int) Tests.

The use of assertThatExceptionOfType with withMessage for exception testing in ofNumericCode(int) tests is correctly implemented.


391-393: Use AssertJ for Exception Testing with Message in ofNumericCode(int) Tests.

The use of assertThatExceptionOfType with withMessage for exception testing in ofNumericCode(int) tests is appropriate.


402-408: Migrate to AssertJ for of(Locale) Tests.

The migration to AssertJ for testing the of(Locale) method is correctly implemented, maintaining the original logic.


413-414: Use AssertJ for Exception Testing in of(Locale) Tests.

The use of assertThatExceptionOfType for exception testing in of(Locale) tests is well-executed, improving fluency.


419-421: Use AssertJ for Exception Testing with Message in of(Locale) Tests.

The use of assertThatExceptionOfType with withMessage for exception testing in of(Locale) tests is a good practice, enhancing clarity.


430-430: Migrate to AssertJ for ofCountry(String) Test.

The migration to AssertJ for testing the ofCountry(String) method is correctly implemented, maintaining the original logic.


435-436: Use AssertJ for Exception Testing in ofCountry(String) Tests.

The use of assertThatExceptionOfType for exception testing in ofCountry(String) tests is well-executed, improving fluency.


441-443: Use AssertJ for Exception Testing with Message in ofCountry(String) Tests.

The use of assertThatExceptionOfType with withMessage for exception testing in ofCountry(String) tests is a good practice, enhancing clarity.


458-458: Migrate to AssertJ for Serialization Test.

The migration to AssertJ for testing serialization is correctly implemented, maintaining the original logic.


470-473: Use AssertJ for Exception Testing with Message in Serialization Tests.

The use of assertThatExceptionOfType with withMessageContaining for exception testing in serialization tests is a good practice, enhancing clarity.


485-488: Use AssertJ for Exception Testing with Message in Serialization Tests.

The use of assertThatExceptionOfType with withMessageContaining for exception testing in serialization tests is correctly implemented.


498-498: Migrate to AssertJ for getNumeric3Code Tests.

The migration to AssertJ for testing getNumeric3Code is correctly implemented, maintaining the original logic.


504-510: Migrate to AssertJ for getNumeric3Code Tests.

The migration to AssertJ for testing getNumeric3Code is well-executed, preserving the original functionality.


516-516: Migrate to AssertJ for getNumeric3Code Test.

The migration to AssertJ for testing getNumeric3Code is correctly applied, enhancing readability.


525-525: Migrate to AssertJ for getNumericCode Test.

The migration to AssertJ for testing getNumericCode is correctly implemented, maintaining the original logic.


534-537: Migrate to AssertJ for getCurrencyCodes Test.

The migration to AssertJ for testing getCurrencyCodes is well-executed, preserving the original functionality.


546-558: Migrate to AssertJ for getDecimalPlaces Tests.

The migration to AssertJ for testing getDecimalPlaces is correctly implemented, maintaining the original logic.


567-579: Migrate to AssertJ for isPseudoCurrency Tests.

The migration to AssertJ for testing isPseudoCurrency is well-executed, preserving the original functionality.


Line range hint 591-603: Migrate to AssertJ for getSymbol Tests.

The migration to AssertJ for testing getSymbol is correctly implemented, maintaining the original logic.


Line range hint 615-627: Migrate to AssertJ for getSymbol Tests.

The migration to AssertJ for testing getSymbol is well-executed, preserving the original functionality.


Line range hint 642-654: Migrate to AssertJ for getSymbol(Locale) Tests.

The migration to AssertJ for testing getSymbol(Locale) is correctly implemented, maintaining the original logic.


Line range hint 666-678: Migrate to AssertJ for getSymbol(Locale) Tests.

The migration to AssertJ for testing getSymbol(Locale) is well-executed, preserving the original functionality.


Line range hint 690-714: Migrate to AssertJ for getSymbol(Locale) Tests.

The migration to AssertJ for testing getSymbol(Locale) is correctly applied, enhancing readability.


726-726: Migrate to AssertJ for toCurrency Test.

The migration to AssertJ for testing toCurrency is correctly implemented, maintaining the original logic.


737-748: Migrate to AssertJ for compareTo Tests.

The migration to AssertJ for testing compareTo is well-executed, preserving the original functionality.


753-754: Use AssertJ for Exception Testing in compareTo Tests.

The use of assertThatExceptionOfType for exception testing in compareTo tests is well-executed, improving fluency.


765-774: Migrate to AssertJ for equals and hashCode Tests.

The migration to AssertJ for testing equals and hashCode is correctly implemented, maintaining the original logic.


780-783: Migrate to AssertJ for equals False Tests.

The migration to AssertJ for testing equals with false cases is well-executed, preserving the original functionality.


792-792: Migrate to AssertJ for toString Test.

The migration to AssertJ for testing toString is correctly implemented, maintaining the original logic.

pom.xml (2)

528-533: Add AssertJ Dependency.

The AssertJ dependency is correctly added to the pom.xml with the appropriate scope for testing purposes.


794-794: Declare AssertJ Version Property.

The AssertJ version property is correctly declared, allowing for centralized version management.

src/test/java/org/joda/money/format/TestMoneyFormatterBuilder.java (50)

18-19: Import changes approved.

The import statements correctly include AssertJ assertions, aligning with the updated test methods.


79-80: AssertJ assertions enhance readability.

The use of assertThat(...).isEqualTo(...) improves the expressiveness of the assertions compared to JUnit's assertEquals.


88-89: Consistent use of AssertJ assertions.

The transition to assertThat(...).isEqualTo(...) is consistent and maintains the logic of the original test.


97-101: AssertJ assertions correctly handle parsing checks.

The use of assertThat(...).isFalse() and assertThat(...).isEqualTo(...) accurately reflects the intended test logic for parsing.


109-113: Correct handling of error conditions with AssertJ.

The assertions effectively capture error conditions using assertThat(...).isTrue() and assertThat(...).isNull().


121-125: AssertJ assertions for empty input parsing.

The use of AssertJ assertions accurately tests the behaviour with empty input, maintaining test clarity.


133-134: AssertJ assertions in numeric code tests.

The transition to AssertJ assertions in numeric code tests maintains logical integrity and improves readability.


142-146: AssertJ assertions for parsing numeric codes.

The assertions correctly verify the parsing logic using AssertJ, ensuring test accuracy.


154-158: Effective use of AssertJ for error conditions.

The assertions capture the error conditions clearly, using assertThat(...).isTrue() for error checks.


166-170: AssertJ assertions for invalid currency parsing.

The test correctly uses AssertJ to assert error states when parsing invalid currency codes.


178-182: AssertJ assertions for empty string parsing.

The assertions effectively handle the test case for empty string parsing, ensuring clarity and correctness.


190-191: AssertJ assertions for currency numeric code print.

The use of assertThat(...).isEqualTo(...) aligns with the intended test logic and enhances readability.


199-203: AssertJ assertions for successful parsing.

The assertions correctly verify successful parsing scenarios, maintaining test integrity.


211-215: AssertJ assertions for padded numeric codes.

The test uses AssertJ assertions to effectively check parsing with padded numeric codes, ensuring accuracy.


223-227: AssertJ assertions for non-padded numeric codes.

The assertions accurately reflect the expected behaviour for non-padded numeric code parsing.


235-239: AssertJ assertions for different numeric code formats.

The test correctly uses AssertJ to verify parsing with different numeric code formats, maintaining clarity.


247-251: AssertJ assertions for short input parsing.

The assertions effectively handle scenarios where the input is too short, using assertThat(...).isTrue() for error checks.


259-263: AssertJ assertions for bad currency input.

The test uses AssertJ assertions to accurately verify behaviour with bad currency input, ensuring correctness.


271-275: AssertJ assertions for empty input handling.

The assertions correctly capture the expected behaviour when parsing empty input, maintaining test clarity.


283-284: AssertJ assertions for localized currency symbols.

The use of AssertJ assertions enhances the readability and expressiveness of the test for localized currency symbols.


291-291: AssertJ assertions for parser checks.

The test correctly uses assertThat(...).isFalse() to verify parser behaviour, ensuring logical consistency.


299-300: AssertJ assertions for literal printing.

The transition to AssertJ assertions for literal printing tests maintains clarity and correctness.


307-308: AssertJ assertions for empty literal printing.

The assertions correctly handle the test case for empty literal printing, using AssertJ for clarity.


315-316: AssertJ assertions for null literal printing.

The use of AssertJ assertions accurately captures the expected behaviour for null literal printing.


324-328: AssertJ assertions for literal parsing.

The assertions effectively verify the parsing logic for literals, maintaining test integrity.


336-340: AssertJ assertions for short literal parsing.

The test uses AssertJ assertions to accurately capture error conditions for short literal parsing.


348-352: AssertJ assertions for non-matching literals.

The assertions correctly verify behaviour when parsing non-matching literals, using AssertJ for clarity.


374-375: AssertJ assertions for parameterized amount tests.

The use of AssertJ assertions in parameterized tests enhances expressiveness and maintains logical consistency.


382-383: AssertJ assertions for locale-specific amount formatting.

The assertions effectively handle locale-specific formatting, using AssertJ for improved readability.


390-391: AssertJ assertions for JPY amount formatting.

The test correctly uses AssertJ assertions to verify formatting for JPY amounts, ensuring clarity.


399-399: AssertJ assertions for BHD amount formatting.

The assertions accurately capture the expected formatting for BHD amounts, using AssertJ for clarity.


420-421: AssertJ assertions for localized amount formatting.

The use of AssertJ assertions in localized amount tests enhances readability and expressiveness.


428-429: AssertJ assertions for US locale amount formatting.

The assertions correctly verify amount formatting for the US locale, using AssertJ for improved clarity.


436-437: AssertJ assertions for FR locale JPY formatting.

The test uses AssertJ assertions to accurately capture formatting for JPY amounts in the FR locale.


443-444: AssertJ assertions for null MoneyAmountStyle.

The use of assertThatExceptionOfType(...).isThrownBy(...) effectively captures the expected exception behaviour.


625-629: AssertJ assertions for MoneyAmountStyle tests.

The assertions correctly verify the expected output for different MoneyAmountStyles, ensuring test accuracy.


643-647: AssertJ assertions for JPY MoneyAmountStyle tests.

The use of AssertJ assertions maintains clarity and correctness in testing JPY MoneyAmountStyles.


661-665: AssertJ assertions for BHD MoneyAmountStyle tests.

The assertions effectively verify the expected behaviour for BHD MoneyAmountStyles, ensuring logical consistency.


677-677: AssertJ assertions for issue-specific test.

The use of AssertJ assertions captures the expected behaviour for the specific issue test case, maintaining clarity.


701-702: AssertJ assertions for extended grouping tests.

The assertions correctly verify the expected output for extended grouping scenarios, using AssertJ for expressiveness.


715-715: AssertJ assertions for excess grouping parsing.

The test uses AssertJ assertions to accurately capture behaviour for excess grouping parsing, ensuring clarity.


730-733: AssertJ assertions for MoneyPrinter tests.

The assertions correctly verify the behaviour of MoneyPrinter implementations, using AssertJ for improved readability.


748-751: AssertJ assertions for MoneyParser tests.

The use of AssertJ assertions enhances the clarity and expressiveness of the MoneyParser tests.


758-760: AssertJ assertions for null MoneyPrinter and MoneyParser.

The assertions effectively capture the expected behaviour when both MoneyPrinter and MoneyParser are null.


768-768: AssertJ assertions for MoneyFormatter append tests.

The use of AssertJ assertions maintains clarity and correctness in testing the appending of MoneyFormatters.


787-797: AssertJ assertions for signed formatting tests.

The assertions correctly verify the expected behaviour for signed formatting scenarios, using AssertJ for clarity.


820-827: AssertJ assertions for PZN formatting tests.

The use of AssertJ assertions enhances the expressiveness and readability of the PZN formatting tests.


846-852: AssertJ assertions for edge case formatting tests.

The assertions effectively capture the expected behaviour for edge case formatting scenarios, using AssertJ for improved clarity.


859-859: AssertJ assertions for default locale tests.

The use of AssertJ assertions correctly verifies the default locale behaviour, ensuring test accuracy.


865-865: AssertJ assertions for specific locale tests.

The assertions effectively verify the expected behaviour for specific locale settings, using AssertJ for clarity.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b4f1813 and 2b0e1a7.

Files selected for processing (6)
  • src/test/java/org/joda/money/TestCurrencyUnit.java (33 hunks)
  • src/test/java/org/joda/money/TestCurrencyUnitExtension.java (5 hunks)
  • src/test/java/org/joda/money/format/TestMoneyAmountStyle.java (6 hunks)
  • src/test/java/org/joda/money/format/TestMoneyFormatter.java (9 hunks)
  • src/test/java/org/joda/money/format/TestMoneyFormatterBuilder.java (15 hunks)
  • src/test/java/org/joda/money/format/TestMoneyParseContext.java (2 hunks)
Files skipped from review as they are similar to previous changes (6)
  • src/test/java/org/joda/money/TestCurrencyUnit.java
  • src/test/java/org/joda/money/TestCurrencyUnitExtension.java
  • src/test/java/org/joda/money/format/TestMoneyAmountStyle.java
  • src/test/java/org/joda/money/format/TestMoneyFormatter.java
  • src/test/java/org/joda/money/format/TestMoneyFormatterBuilder.java
  • src/test/java/org/joda/money/format/TestMoneyParseContext.java

@jodastephen jodastephen merged commit 0ae24d5 into main Aug 18, 2024
4 checks passed
@jodastephen jodastephen deleted the asserj branch August 18, 2024 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant