Skip to content

ModellingMonetaryAmountsTest.testImplementComparable does not cover the specification #18

Description

@oboehm

For Comparable only two notices appears in section 4.2.2.:

  • must be comparable
  • Comparison methods for comparing two arbitrary amounts of the same currency, hereby comparing
    based on the (effective) numeric value (e.g. ignoring trailing zeroes).

When I run the TCK I get the following error report:

[FAILED]  4.2.2 For each amount class, test is Comparable.(ModellingMonetaryAmountsTest#testImplementComparable):
java.lang.AssertionError: Section 4.2.2: Comparable failed for: de.jfachwert.bank.Geldbetrag
	at org.testng.AssertJUnit.fail(AssertJUnit.java:59)
	at org.testng.AssertJUnit.assertTrue(AssertJUnit.java:24)
	at org.javamoney.tck.tests.ModellingMonetaryAmountsTest.testImplementComparable(ModellingMonetaryAmountsTest.java:2522)
        ...

The input values for failed tests are:

  • amount = "0 XXX"
  • amount3 = "1 CHF"

The failing assert is assertTrue(amount.compareTo(amount3) > 0), or in other words

"0 XXX" > "1 CHF" should be true.

This is not covered by the specification (see above - or did I miss something?) and also from the semantic view I would expect it the other way around.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions