@SpecVersion(spec="JSR 354", version="1.0.0") public class ModellingMonetaryAmountsTest extends Object
Constructor and Description |
---|
ModellingMonetaryAmountsTest() |
Modifier and Type | Method and Description |
---|---|
void |
testAbsolute()
Test abs() for getting the absolute value.
|
void |
testAdd_ExceedsCapabilities()
Tests that add(), which results in an amount exceeding the max MonetaryContext throws
a MonetaryException.
|
void |
testAdd_IncompatibleCurrencies()
Tests that add() with non matching currencies throws a
MonetaryException.
|
void |
testAdd_Null()
Tests that add(), which results in an amount exceeding the max MonetaryContext throws
a MonetaryException.
|
void |
testAdd_Zero()
Tests that add(0) should return itself.
|
void |
testAddMixedFractions()
Tests that add() correctly adds two values, using positive and negative fractions.
|
void |
testAddMixedIntegers()
Tests that add() correctly adds two values, using positive and negative integers.
|
void |
testAddNegativeIntegers()
Tests that add() correctly adds two values, using negative integers.
|
void |
testAddPositiveFractions()
Tests that add() correctly adds two values, using fractions.
|
void |
testAddPositiveIntegers()
Tests that add() correctly adds two values, using positive integers.
|
void |
testCurrencyCode()
For each MonetaryAmount implementation: Ensure getCurrencyCode
returns correct results.
|
void |
testDivide()
Test divide() function allow to divide numbers.
|
void |
testDivideAndRemainder()
Test divideAndRemainder()allow to divide/remind numbers.
|
void |
testDivideAndRemainderDoubleNaN()
Test divideAndRemainder(null) throws an NullPointerException.
|
void |
testDivideAndRemainderDoubleNEGATIVE_INFINITY()
Test divideAndRemainder(null) throws an NullPointerException.
|
void |
testDivideAndRemainderDoublePOSITIVE_INFINITY()
Test divideAndRemainder(null) throws an NullPointerException.
|
void |
testDivideAndRemainderNull()
Test divideAndRemainder(null) throws an NullPointerException.
|
void |
testDivideAndRemainderOne()
Test divideAndRemainder(1) returns this/ZERO.
|
void |
testDivideAndRemainderZero()
Test divideAndRemainder(0) throws an ArithmeticException.
|
void |
testDivideDoubleNaN()
Test divide(0) function must throw an ArithmeticException.
|
void |
testDivideDoubleNEGATIVE_INFINITY()
Test divide(Double.NEGATIVE_INFINITY) function must return ZERO amount.
|
void |
testDivideDoublePOSITIVE_INFINITY()
Test divide(0) function must return ZERO amount.
|
void |
testDivideNull()
Test divide(null)must throw a NullPointerException.
|
void |
testDivideOne()
Test divide(1) should return this.
|
void |
testDivideToIntegralValue()
Test divideToIntegralValue() function allow to divide numbers.
|
void |
testDivideZero()
Test divide(0) function must throw an ArithmeticException.
|
void |
testEnsureMonetaryAmount()
Ensure at least one MonetaryAmount implementation is registered,
by calling Monetary.getAmountTypes();
|
void |
testGetMonetaryContext()
For each MonetaryAmount implementation: Ensure
getContext() returns correct results.
|
void |
testGetNumber()
For each MonetaryAmount implementation: Ensure getNumber()
returns correct results.
|
void |
testImmutable()
Implementations of MonetaryAmount must be Serializable.
|
void |
testImplementComparable()
Implementations of MonetaryAmount must be Comparable.
|
void |
testImplementsEquals()
Implementations of MonetaryAmount must implement
equals,
considering number, currency and implementation type,
monetary
context.
|
void |
testImplementsHashCode()
Implementations of MonetaryAmount must implement hashCode,
considering number, currency and implementation type,
monetary
context.
|
void |
testIsNegative()
For each MonetaryAmount implementation: Ensure isNegative()
returns correct results.
|
void |
testIsNegativeOrZero()
For each MonetaryAmount implementation: Ensure isNegativeOrZero()
returns correct results.
|
void |
testIsPositive()
For each MonetaryAmount implementation: Ensure isPositive()
returns correct results.
|
void |
testIsPositiveOrZero()
For each MonetaryAmount implementation: Ensure isPositiveOrZero()
returns correct results.
|
void |
testIsZero()
For each MonetaryAmount implementation: Ensure isZero()
returns correct results.
|
void |
testIsZeroAdvanced()
For each MonetaryAmount implementation: Ensure isZero()
returns correct results (-0, +0 == 0).
|
void |
testMonetaryAmount_isEqualTo()
Test isEqualTo() is implemented correctly for each amount type regardless of trailing
zeroes.
|
void |
testMonetaryAmount_isEqualToRegardlessMonetaryContext()
For two amounts with same numeric value and currency:
isEqualTo()} return true, regardless of MonetaryContext.
|
void |
testMonetaryAmount_isEqualToRegardlessType()
For two amounts with same numeric value and currency:
isEqualTo()} return true, regardless of iumplementation type.
|
void |
testMonetaryAmount_isGreaterThan()
Test isGreaterThan() is implemented correctly for each amount type regardless of trailing zeroes.
|
void |
testMonetaryAmount_isGreaterThanOrEquals()
Test isGreaterThanOrEquals() is implemented correctly for each amount type regardless of trailing
zeroes.
|
void |
testMonetaryAmount_isLessThan()
Test isLessThan() is implemented correctly for each amount type regardless of trailing
zeroes.
|
void |
testMonetaryAmount_isLessThanOrEqualTo()
Test isLessThanOrEquals() is implemented correctly for each amount type regardless of trailing
zeroes.
|
void |
testMonetaryAmountFactories_CreateWithCurrencies()
Call getFactory(),of a new MonetaryAmount instance
with a new currency value.The instances must
be non equal and have the according currency value .Do this by passing a literal code
and by passing a CurrencyUnit.
|
void |
testMonetaryAmountFactories_CreateWithMonetaryContext()
Call getFactory(),of a new MonetaryAmount instance
with a new monetary context(if possible-check the max context).
|
void |
testMonetaryAmountFactories_CreateWithMonetaryContextNumberAndCurrency()
Call getFactory(),of a new MonetaryAmount instance with a new monetary context, a
new number and a new currency.
|
void |
testMonetaryAmountFactories_InstancesMustBeEqual()
Call getFactory(), of a new MonetaryAmount instance, with
same input.
|
void |
testMonetaryAmountFactories_InstantesMustBeNotEqual()
Call getFactory(), of a new MonetaryAmount instance with a
new number
value.
|
void |
testMonetaryAmountFactories()
Ensure getFactory returns a MonetaryAmountFactory and that
instances created are of the same type.
|
void |
testMultiply_Decimals()
Test multiply() allow to multiply numbers.
|
void |
testMultiply_DoubleNaN()
Test multiply(Double.NaN) must throw an ArithmeticException.
|
void |
testMultiply_DoubleNEGATIVE_INFINITY()
Test multiply(Double.POSITIVE_INFINITY) must throw an ArithmeticException.
|
void |
testMultiply_DoublePOSITIVE_INFINITY()
Test multiply(Double.POSITIVE_INFINITY) must throw an ArithmeticException.
|
void |
testMultiply_Integral()
Test multiply() allow to multiply numbers.
|
void |
testMultiplyExceedsCapabilities()
Test multiply, which results in an amount exceeding the max
MonetaryContext must throw a
ArithmeticException.
|
void |
testMultiplyNull()
Test multiply(null) must throw an NullPointerException.
|
void |
testMultiplyOne()
Test multiply(1) returns this.
|
void |
testNegate()
Test negate() for negating a value.
|
void |
testQuery()
Ensure query(MonetaryQUery) can be called and produces
valuable results.
|
void |
testQueryInvalidQuery()
Test query(q) throws a MonetaryException, if q throws any exception.
|
void |
testQueryNull()
Test query(null) throws a NullPointerException.
|
void |
testRemainder_DoubleNaN()
Test remainder(null) must throw a NullPointerException
|
void |
testRemainder_DoubleNEGATIVE_INFINITY()
Test remainder(null) must throw a NullPointerException
|
void |
testRemainder_DoublePOSITIVE_INFINITY()
Test remainder(null) must throw a NullPointerException
|
void |
testRemainder()
Test remainder()allow to calculate the remainder.
|
void |
testRemainderNull()
Test remainder(null) must throw a NullPointerException
|
void |
testRemainderZero_Double()
Test remainder(0) must throw an ArithmeticException
|
void |
testRemainderZero_Long()
Test remainder(0) must throw an ArithmeticException
|
void |
testRemainderZero_Number()
Test remainder(0) must throw an ArithmeticException
|
void |
testScaleByPowerOfTen()
Test scaleByPowerOfTen()allow to scale by power of 10.
|
void |
testSignum()
For each MonetaryAmount implementation: signum() function is
implemented correctly.
|
void |
testSubtract_ExceedsCapabilities()
Tests that subtract(), which results in an amount exceeding the max MonetaryContext throws
a MonetaryException.
|
void |
testSubtract_IncompatibleCurrencies()
Tests that subtract() with non matching currencies throws a
MonetaryException.
|
void |
testSubtract_Null()
Tests that subtract(), which results in an amount exceeding the max MonetaryContext throws
a MonetaryException.
|
void |
testSubtract_Zero()
Tests that subtract(0) should return itself.
|
void |
testSubtractMixedFractions()
Tests that subtract() correctly adds two values, using positive and negative fractions.
|
void |
testSubtractMixedIntegers()
Tests that subtract() correctly adds two values, using positive and negative integers.
|
void |
testSubtractNegativeIntegers()
Tests that subtract() correctly adds two values, using negative integers.
|
void |
testSubtractPositiveFractions()
Tests that subtract() correctly adds two values, using fractions.
|
void |
testSubtractPositiveIntegers()
Tests that subtract() correctly adds two values, using positive integers.
|
void |
testWith()
Ensure with(MonetaryOperator) can be called and produces
amounts of the same type and correct value.
|
void |
testWith4ProvidedOperators()
Ensure with(MonetaryOperator) can be called and produces
amounts of the same type and correct value, testing operators provided by TCKTestSetup.
|
void |
testWithInvalidOperator()
Test with(m) throws a MonetaryException, if m throws any exception.
|
void |
testWithNull()
Test with(null) throws a NullPointerException.
|
void |
testWithNull4ProvidedOperators()
Test with(null) throws a NullPointerException.
|
public ModellingMonetaryAmountsTest()
@SpecAssertion(section="4.2.2", id="422-0") public void testEnsureMonetaryAmount()
@SpecAssertion(section="4.2.2", id="422-A1") public void testCurrencyCode()
@SpecAssertion(section="4.2.2", id="422-A2") public void testGetNumber()
@SpecAssertion(section="4.2.2", id="422-A3") public void testGetMonetaryContext()
@SpecAssertion(section="4.2.2", id="422-A4") public void testIsNegative()
@SpecAssertion(section="4.2.2", id="422-A5") public void testIsPositive()
@SpecAssertion(section="4.2.2", id="422-A6") public void testIsZero()
@SpecAssertion(section="4.2.2", id="422-A6") public void testIsZeroAdvanced()
@SpecAssertion(section="4.2.2", id="422-A7") public void testSignum()
@SpecAssertion(section="4.2.2", id="422-A8") public void testIsNegativeOrZero()
@SpecAssertion(section="4.2.2", id="422-A9") public void testIsPositiveOrZero()
@SpecAssertion(section="4.2.2", id="422-B1") public void testMonetaryAmountFactories()
@SpecAssertion(section="4.2.2", id="422-B2") public void testMonetaryAmountFactories_InstancesMustBeEqual()
@SpecAssertion(section="4.2.2", id="422-B3") public void testMonetaryAmountFactories_InstantesMustBeNotEqual()
@SpecAssertion(section="4.2.2", id="422-B4") public void testMonetaryAmountFactories_CreateWithCurrencies()
@SpecAssertion(section="4.2.2", id="422-B5") public void testMonetaryAmountFactories_CreateWithMonetaryContext()
@SpecAssertion(section="4.2.2", id="422-B6") public void testMonetaryAmountFactories_CreateWithMonetaryContextNumberAndCurrency()
@SpecAssertion(section="4.2.2", id="422-C1") public void testMonetaryAmount_isGreaterThan()
@SpecAssertion(section="4.2.2", id="422-C2") public void testMonetaryAmount_isGreaterThanOrEquals()
@SpecAssertion(section="4.2.2", id="422-C3") public void testMonetaryAmount_isLessThan()
@SpecAssertion(section="4.2.2", id="422-C4") public void testMonetaryAmount_isLessThanOrEqualTo()
@SpecAssertion(section="4.2.2", id="422-C5") public void testMonetaryAmount_isEqualTo()
@SpecAssertion(section="4.2.2", id="422-C6") public void testMonetaryAmount_isEqualToRegardlessMonetaryContext()
@SpecAssertion(section="4.2.2", id="422-C7") public void testMonetaryAmount_isEqualToRegardlessType()
@SpecAssertion(section="4.2.2", id="422-D1") public void testAddPositiveIntegers()
@SpecAssertion(section="4.2.2", id="422-D1") public void testAddNegativeIntegers()
@SpecAssertion(section="4.2.2", id="422-D1") public void testAddPositiveFractions()
@SpecAssertion(section="4.2.2", id="422-D1") public void testAddMixedIntegers()
@SpecAssertion(section="4.2.2", id="422-D1") public void testAddMixedFractions()
@SpecAssertion(section="4.2.2", id="422-D2") public void testAdd_IncompatibleCurrencies()
@SpecAssertion(section="4.2.2", id="422-D3") public void testAdd_Zero()
@SpecAssertion(section="4.2.2", id="422-D4") public void testAdd_ExceedsCapabilities()
@SpecAssertion(section="4.2.2", id="422-D5") public void testAdd_Null()
@SpecAssertion(section="4.2.2", id="422-D6") public void testSubtractPositiveIntegers()
@SpecAssertion(section="4.2.2", id="422-D6") public void testSubtractNegativeIntegers()
@SpecAssertion(section="4.2.2", id="422-D6") public void testSubtractPositiveFractions()
@SpecAssertion(section="4.2.2", id="422-D6") public void testSubtractMixedIntegers()
@SpecAssertion(section="4.2.2", id="422-D6") public void testSubtractMixedFractions()
@SpecAssertion(section="4.2.2", id="422-D8") public void testSubtract_IncompatibleCurrencies()
@SpecAssertion(section="4.2.2", id="422-D7") public void testSubtract_Zero()
@SpecAssertion(section="4.2.2", id="422-D9") public void testSubtract_ExceedsCapabilities()
@SpecAssertion(section="4.2.2", id="422-D10") public void testSubtract_Null()
@SpecAssertion(section="4.2.2", id="422-D11") public void testMultiply_Integral()
@SpecAssertion(section="4.2.2", id="422-D11") public void testMultiply_Decimals()
@SpecAssertion(section="4.2.2", id="422-D12") public void testMultiplyOne()
@SpecAssertion(section="4.2.2", id="422-D13") public void testMultiplyExceedsCapabilities()
@SpecAssertion(section="4.2.2", id="422-D14") public void testMultiplyNull()
@SpecAssertion(section="4.2.2", id="422-D14") public void testMultiply_DoubleNaN()
@SpecAssertion(section="4.2.2", id="422-D14") public void testMultiply_DoublePOSITIVE_INFINITY()
@SpecAssertion(section="4.2.2", id="422-D14") public void testMultiply_DoubleNEGATIVE_INFINITY()
@SpecAssertion(section="4.2.2", id="422-D15") public void testDivide()
@SpecAssertion(section="4.2.2", id="422-D15") public void testDivideToIntegralValue()
@SpecAssertion(section="4.2.2", id="422-D16") public void testDivideZero()
@SpecAssertion(section="4.2.2", id="422-D16") public void testDivideDoubleNaN()
@SpecAssertion(section="4.2.2", id="422-D16") public void testDivideDoublePOSITIVE_INFINITY()
@SpecAssertion(section="4.2.2", id="422-D16") public void testDivideDoubleNEGATIVE_INFINITY()
@SpecAssertion(section="4.2.2", id="422-D17") public void testDivideOne()
@SpecAssertion(section="4.2.2", id="422-D18") public void testDivideNull()
@SpecAssertion(section="4.2.2", id="422-D19") public void testRemainder()
@SpecAssertion(section="4.2.2", id="422-D20") public void testRemainderZero_Double()
@SpecAssertion(section="4.2.2", id="422-D20") public void testRemainderZero_Long()
@SpecAssertion(section="4.2.2", id="422-D20") public void testRemainderZero_Number()
@SpecAssertion(section="4.2.2", id="422-D21") public void testRemainderNull()
@SpecAssertion(section="4.2.2", id="422-D21") public void testRemainder_DoubleNaN()
@SpecAssertion(section="4.2.2", id="422-D21") public void testRemainder_DoublePOSITIVE_INFINITY()
@SpecAssertion(section="4.2.2", id="422-D21") public void testRemainder_DoubleNEGATIVE_INFINITY()
@SpecAssertion(section="4.2.2", id="422-D22") public void testDivideAndRemainder()
@SpecAssertion(section="4.2.2", id="422-D23") public void testDivideAndRemainderZero()
@SpecAssertion(section="4.2.2", id="422-D24") public void testDivideAndRemainderNull()
@SpecAssertion(section="4.2.2", id="422-D24") public void testDivideAndRemainderDoubleNaN()
@SpecAssertion(section="4.2.2", id="422-D24") public void testDivideAndRemainderDoublePOSITIVE_INFINITY()
@SpecAssertion(section="4.2.2", id="422-D24") public void testDivideAndRemainderDoubleNEGATIVE_INFINITY()
@SpecAssertion(section="4.2.2", id="422-D25") public void testDivideAndRemainderOne()
@SpecAssertion(section="4.2.2", id="422-D26") public void testScaleByPowerOfTen()
@SpecAssertion(section="4.2.2", id="422-D27") public void testAbsolute()
@SpecAssertion(section="4.2.2", id="422-D28") public void testNegate()
@SpecAssertion(section="4.2.2", id="422-E1") public void testWith()
@SpecAssertion(section="4.2.2", id="422-E1") public void testWith4ProvidedOperators()
@SpecAssertion(section="4.2.2", id="422-E2") public void testWithInvalidOperator()
@SpecAssertion(section="4.2.2", id="422-E2") public void testWithNull()
@SpecAssertion(section="4.2.2", id="422-E2") public void testWithNull4ProvidedOperators()
@SpecAssertion(section="4.2.2", id="422-E3") public void testQuery()
@SpecAssertion(section="4.2.2", id="422-E4") public void testQueryInvalidQuery()
@SpecAssertion(section="4.2.2", id="422-E4") public void testQueryNull()
@SpecAssertion(section="4.2.2", id="422-F1") public void testImplementsHashCode()
@SpecAssertion(section="4.2.2", id="422-F2") public void testImplementsEquals()
@SpecAssertion(section="4.2.2", id="422-F3") public void testImplementComparable()
@SpecAssertion(section="4.2.2", id="422-F4") public void testImmutable()
Copyright © 2012-2015 JavaMoney. All Rights Reserved.