Chapter | Assertions | Testable | Total Tested | Total Tests | Tested (problematic) |
Tested (working) |
Coverage % |
---|---|---|---|---|---|---|---|
0 TCK Setup | 1 | 1 | 1 | 0 | 0 | 1 | 100.00% |
1 Introduction, Use Cases, Requirements (no tests) | 0 | 0 | 0 | 0 | 0 | 0 | |
2 Use Cases | 0 | 0 | 0 | 0 | 0 | 0 | |
3 Requirements | 0 | 0 | 0 | 0 | 0 | 0 | |
4 Specification | 168 | 166 | 166 | 241 | 0 | 166 | 100.00% |
5 Meta-Data Contexts and Query Models | 0 | 0 | 0 | 0 | 0 | 0 | |
6 Implementation Recommendations | 0 | 0 | 0 | 0 | 0 | 0 | |
7 Examples | 0 | 0 | 0 | 0 | 0 | 0 | |
Total | 169 | 167 | 167 | 241 | 0 | 167 | 100.00% |
Colour Key |
---|
Assertion is covered |
Assertion is not covered |
Assertion test is unimplemented |
Assertion is untestable |
Tests the correct setup of the TCK
Ensure an implementation of org.javamoney.tck.JSR354TestConfiguration is registered using the java.util.ServiceLoader.
Coverage
A. Managing the Currency code
Ensure at least one javax.money.CurrencyUnit implementation is available and registered/accessible from MonetaryCurrencies.
Coverage
Test that currencies returned for same ISO currency code are equal, ensure when listing all available currencies, that the code is unique.
Coverage
Ensure all ISO 3-letters codes as defined by the JDK are also available from MonetaryCurrencies.
Coverage
Test that JDK currencies returned match the values of corresponding JDK Currency (code, numeric code, default fraction digits).
Coverage
B. Currency Unit Implementation Requirements
CurrencyUnit must implement hashCode.
Coverage
CurrencyUnit must implement equals.
Coverage
CurrencyUnit implementation must be Comparable.
Coverage
CurrencyUnit implementation must be immutable.
Coverage
CurrencyUnit implementation must be thread safe.
CurrencyUnit implementation must be serializable.
Coverage
Preconditions
Ensure at least one javax.money.MonetaryAmount implementation is registered, by calling MonetaryAmounts.getAmountTypes();
Coverage
A. Data Interoperability
For each MonetaryAmount implementation: Ensure getCurrencyCode returns correct results.
Coverage
For each MonetaryAmount implementation: Ensure getNumber() returns correct results.
Coverage
For each MonetaryAmount implementation: Ensure getMonetaryContext() returns correct results.
Coverage
For each MonetaryAmount implementation: Ensure isNegative() returns correct results.
Coverage
For each MonetaryAmount implementation: Ensure isPositive() returns correct results.
Coverage
For each MonetaryAmount implementation: Ensure isZero() returns correct results (-0, +0 == 0).
Coverage
For each MonetaryAmount implementation: signum() function is implemented correctly.
Coverage
For each MonetaryAmount implementation: Ensure isNegativeOrZero() returns correct results.
Coverage
For each MonetaryAmount implementation: Ensure isPositiveOrZero() returns correct results.
Coverage
B. Prototyping Support
Ensure getFactory returns a MonetaryAmountFactory and that instances created are of the same type.
Coverage
Call getFactory(), create a new MonetaryAmount instance, with same input. The instances must be equal (or even be identical!).
Coverage
Call getFactory(), create a new MonetaryAmount instance with a new number value. The instances must be non equal and have the according numeric value.
Coverage
Call getFactory(), create a new MonetaryAmount instance with a new currency value. The instances must be non equal and have the according currency value. Do this by code and by passing a CurrencyUnit.
Coverage
Call getFactory(), create a new MonetaryAmount instance with a new monetary context (if possible - check the max context). The instances must be non equal and have the same currency and number value.
Coverage
Call getFactory(), create a new MonetaryAmount instance with a new monetary context, a new number and a new currency. The instances must be non equal.
Coverage
C. Comparison Methods
The isGreaterThan() implemented correctly.
Coverage
The isGreaterThanOrEqals() implemented correctly, regardless of trailing zeroes.
Coverage
The isLessThan() implemented correctly.
Coverage
The isLessThanOrEqals() implemented correctly, regardless of trailing zeroes.
Coverage
For two amounts with same numeric value and currency: isEqualTo() return true, regardless of trailing zeroes.
Coverage
For two amounts with same numeric value and currency: isEqualTo() return true, regardless of MonetaryContext.
Coverage
For two amounts with same numeric value and currency: isEqualTo() return true, regardless of Implementation Type.
Coverage
D. Basic Arithmetic Operations
Tests that add() correctly adds two values.
Coverage
Tests that add() with non matching currencies throws a MonetaryException.
Coverage
Tests that add(0) should return itself.
Coverage
Tests that add() which results in an amount exceeding the max MonetaryContext throws a MonetaryException.
Coverage
Tests that add(null) throws an NullPointerException.
Coverage
subtract() must subtract a value from another.
Coverage
subtract(0) should return itself.
Coverage
subtract() with non matching currencies must throw a MonetaryException.
Coverage
subtract() which results in an amount exceeding the max MonetaryContext must throw a MonetaryException.
Coverage
subtract(null) must throw an NullPointerException.
Coverage
multiply() allow to multiply numbers.
Coverage
multiply(1) should return itself.
Coverage
multiply() which results in an amount exceeding the max MonetaryContext must throw a MonetaryException.
Coverage
multiply(null) must throw an NullPointerException.
Coverage
divide() function allow to divide numbers.
Coverage
divide(0) function must throw an ArithmeticException.
Coverage
divide(1) should return itself.
Coverage
divide(null) must throw an NullPointerException.
Coverage
remainder() allow to calculate the remainder.
Coverage
remainder(0) must throw an ArithmeticException.
Coverage
remainder(null) must throw an NullPointerException.
Coverage
divideAndRemainder() allow to divide/remind numbers.
Coverage
divideAndRemainder(0) must throw an ArithmeticException.
Coverage
divideAndRemainder(null) must throw an NullPointerException.
Coverage
divideAndRemainder(1) must retzrn -8itself, 0).
Coverage
scaleByPowerOfTen() allow to scale by power of 10.
Coverage
abs() allow to calculate the absolute value.
Coverage
negate() function allow to negate the value.
Coverage
E. Functional Extension Points
Ensure with(MonetaryOperator) can be called and produces amounts of the same type and correct value.
Coverage
When an invalid operator is passed (throwing any exception), a MonetaryException must be thrown. When null is passed, an NPE must be thrown.
Coverage
Ensure query(MonetaryQUery) can be called and produces valuable results.
Coverage
When an invalid query is passed (throwing any exception), a MonetaryException must be thrown. When null is passed, an NPE must be thrown.
Coverage
F. Monetary Amount Implementation Requirements
Implementations of MonetaryAmount must implement hashCode, considering number, currency and implementation type, monetary context.
Coverage
Implementations of MonetaryAmount must implement equals, considering number, currency and implementation type, monetary context.
Coverage
Implementations of MonetaryAmount must be Comparable.
Coverage
Implementations of MonetaryAmount must be immutable.
Coverage
Implementations of MonetaryAmount should be thread-safe.
A. Testing Numeric Externalization for positive values
Checks if number type is not null and returning a concrete (no abstract class or interface).
Coverage
Check if a correct integer value is returned, no truncation is allowed to be performed.
Coverage
Check if a correct long value is returned, no truncation is allowed to be performed.
Coverage
Check if a correct double value is returned, no truncation is allowed to be performed.
Coverage
Check if a correct number value is returned, no truncation is allowed to be performed. Check should be done for every JDK type supported.
Coverage
Check if a correct integer value is returned, truncation is allowed to be performed.
Coverage
Check if a correct long value is returned, truncation is allowed to be performed.
Coverage
Check if a correct double value is returned, truncation is allowed to be performed.
Coverage
Check if a correct number value is returned, truncation is allowed to be performed. Check should be done for every JDK type supported.
Coverage
Test correct precision values, including border cases.
Coverage
Test correct scale values, including border cases.
Coverage
B. Testing Numeric Externalization for negative values
Checks if number type is not null and returning a concrete (no abstract class or interface).
Coverage
Check if a correct integer value is returned, no truncation is allowed to be performed.
Coverage
Check if a correct long value is returned, no truncation is allowed to be performed.
Coverage
Check if a correct double value is returned, no truncation is allowed to be performed.
Coverage
Check if a correct number value is returned, no truncation is allowed to be performed. Check should be done for every JDK type supported.
Coverage
Check if a correct integer value is returned, truncation is allowed to be performed.
Coverage
Check if a correct long value is returned, truncation is allowed to be performed.
Coverage
Check if a correct double value is returned, truncation is allowed to be performed.
Coverage
Check if a correct number value is returned, truncation is allowed to be performed. Check should be done for every JDK type supported.
Coverage
Test correct precision values, including border cases.
Coverage
Test correct scale values, including border cases.
Coverage
C. Testing Numeric Externalization for zero values
Checks if number type is not null and returning a concrete (no abstract class or interface).
Coverage
Check if a correct integer value is returned, no truncation is allowed to be performed.
Coverage
Check if a correct long value is returned, no truncation is allowed to be performed.
Coverage
Check if a correct number value is returned, no truncation is allowed to be performed. Check should be done for every JDK type supported.
Coverage
Check if a correct integer value is returned, truncation is allowed to be performed (but is not necessary).
Coverage
Check if a correct long value is returned, truncation is allowed to be performed (but is not necessary).
Coverage
Check if a correct double value is returned, truncation is allowed to be performed (but is not necessary).
Coverage
Check if a correct number value is returned, truncation is allowed to be performed (but is not necessary). Check should be done for every JDK type supported.
Coverage
Test correct precision values, including border cases.
Coverage
Test correct scale values, including border cases.
Coverage
A. Monetary Operator Implementation Requirements
The return type of apply must be the same type as the parameter (amount.getClass() == result.getClass()).
Coverage
A. Accessing MonetaryAmount Factories
Access a MonetaryAmountFactory for each registered type.
Coverage
Checks if getAmountType returns the correct type.
Coverage
Checks for default and max MonetaryContext.
Coverage
Checks if capabilities of default MonetaryContext are less than Max MonetaryContext.
Coverage
B. Testing Creation of Amounts with zero values
For each MonetaryAmount Factory: Create zero amounts from a factory with currencies.
Coverage
For each MonetaryAmount Factory: Create zero amounts from a factory with monetary contexts.
Coverage
For each MonetaryAmount Factory: Bad Case: Create zero amounts from a factory with an invalid currency.
Coverage
For each MonetaryAmount Factory: Bad Case: Create zero amounts from a factory with an invalid MonetaryContext.
Coverage
C. Testing Creation of Amounts with positive values
For each MonetaryAmount Factory: Create positive amounts from a factory with currencies.
Coverage
For each MonetaryAmount Factory: Create positive amounts from a factory with monetary contexts.
Coverage
For each MonetaryAmount Factory: Bad Case: Create positive amounts from a factory with an invalid numeric value (exceeding max MonetaryContext).
Coverage
For each MonetaryAmount Factory: Bad Case: Create positive amounts from a factory with an invalid currency.
Coverage
For each MonetaryAmount Factory: Bad Case: Create positive amounts from a factory with an invalid MonetaryContext.
Coverage
D. Testing Creation of Amounts with negative values
For each MonetaryAmount Factory: Create negative amounts from a factory with currencies.
Coverage
For each MonetaryAmount Factory: Create negative amounts from a factory with monetary contexts.
Coverage
For each MonetaryAmount Factory: Bad Case: Create negative amounts from a factory with an invalid numeric value (exceeding max MonetaryContext).
Coverage
For each MonetaryAmount Factory: Bad Case: Create negative amounts from a factory with an invalid currency.
Coverage
For each MonetaryAmount Factory: Bad Case: Create negative amounts from a factory with an invalid MonetaryContext.
Coverage
A. Accessing Currencies
Test if MonetaryCurrencies provides all ISO related entries, similar to the JDK.
Coverage
Test if MonetaryCurrencies provides all Locale related entries, similar to the JDK.
Coverage
Test if MonetaryCurrencies provides correct check for ISO codes.
Coverage
Test if MonetaryCurrencies provides correct check for Locales.
Coverage
Test for custom MonetaryCurrencies provided, based on the TCK TestProvider.
Coverage
B. Accessing Monetary Amount Factories
Ensure the types available, must be at least one type.
Coverage
Ensure amount factories are accessible for all types available, providing also the some test implementations with the TCK.
Coverage
Ensure amount factories are accessible for all types available, providing also the some test implementations with the TCK, and that every factory accessed is a new instance.
Coverage
Ensure correct query function implementations, providing also the some test implementations with the TCK.
Coverage
Ensure a default factory is returned. Test javamoney.config for configuring default value.
Coverage
C. Accessing Roundings
Access roundings using all defined currencies, including TCK custom currencies.
Coverage
Access roundings using a MonetaryContext. Use different MathContext/RoundingMode, as an attribute, when running on the JDK.
Coverage
Access custom roundings and ensure TCK custom roundings are registered.
Coverage
Test TCK custom roundings.
Coverage
A. Test Basic MonetaryConversions Accessors
Ensure at least one conversion provider is accessible.
Coverage
Access and test different Currency Conversions for the provider in place.
Coverage
Access and test the provider's meta data.
Coverage
Access the default provider chain (must be defined).
Coverage
Access and test conversion using the default provider chain.
Coverage
Bad case: Test access of an inexistent provider.
Coverage
Bad case: Test inclusion of an inexistent provider in a provider chain.
Coverage
A. Test Basic MonetaryConversions Accessors
Test successful conversion for possible currency pairs.
Coverage
Compare conversions done with exchange rates provided for same conversion.
Coverage
Bad case: try converting from/to an inconvertible (custom) currency, ensure CurrencyConversionException is thrown.
Coverage
Bad case: try converting from/to a null currency, ensure CurrencyConversionException is thrown.
Coverage
A. Test Basic MonetaryConversions Accessors
Test access to conversion rates.
Coverage
Ensure additional ConversionContext is passed correctly to SPIs.
Coverage
Bad case: try accessing rates with incosistent data.
Coverage
A. Test Basic MonetaryConversions Accessors
Test correct rate evaluation for different provider chains, providers defined by the TCK.
Coverage
Test correct rate evaluation for different provider chains, providers defined by the TCK, with historic rates.
Coverage
Test availability of providers defined by the TCK.
Coverage
A. Test all concrete MonetaryAmountFormat Implementations
Format several amounts, created using the default factory, but also a test instance, provided by the TCK, to ensure no implementation dependencies on the implementation.
Coverage
Print several amounts, created using the default factory, but also a test instance, provided by the TCK, to ensure no implementation dependencies on the implementation.
Coverage
Parse back several amounts, input created using the formatting from 'Format_formatAmounts'.
Coverage
Get/set default currency, try to parse patterns without currency information.
Coverage
Get/set different amount styles (especially patterns, group sizes, group characters) and compare results with results as from RI. Also apply patterns without currency invovled.
Coverage
B. Accessing Monetary Amount Formats
AccessingMonetaryAmountFormat using MonetaryFormats.getAmountFormat(Locale locale), all locales available also from java.text.DecimalFormat must be supported.
Coverage
AccessingMonetaryAmountFormat using MonetaryFormats.getAmountFormat(AmountStyle style), all locales available also from java.text.DecimalFormat must be supported (using AmountStyle.of(Locale)).
Coverage
Test MonetaryFormats.getAvailableLocales, all locales available also from java.text.DecimalFormat must be supported (using AmountStyle.of(Locale)), more locales are possible.
Coverage
A. Registering Currencies
Test registered CurrencyProviderSpi (at least one instance required). Test behaviour, especially bad case behaviour for invalid input.
Coverage
Test registered MonetaryCurrenciesSingletonSpi (at least one instance required). Test behaviour, especially bad case behaviour for invalid input.
Coverage
B. Registering Monetary Amount Factories
Test registered MonetaryAmountsSpi (at least one instance required). Test behaviour, especially bad case behaviour for invalid input.
Coverage
C. Backing the MonetaryAmounts Singleton
Test registered RoundingProviderSpi (at least one instance required). Test behaviour, especially bad case behaviour for invalid input.
Coverage
D. Registering Roundings
Test registered RoundingProviderSpi (at least one instance required). Test behaviour, especially bad case behaviour for invalid input.
Coverage
A. Adapting Currency Conversion
Test SPI for ExhcnageRateProviders.
Coverage
Test SPI for MonetaryConversions.
Coverage
A. Prodivding Amount Formats
Test registered MonetaryAmountFormatProviderSpi (one is required), especially bad case behaviour for invalid input.
Coverage