Skip to content

Commit

Permalink
Use getAmountFactory(Class<?> type) method instead of default one
Browse files Browse the repository at this point in the history
  • Loading branch information
vyazelenko committed Mar 6, 2014
1 parent 1eb0ee2 commit 32fabc7
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/test/java/org/javamoney/tck/tests/MonetaryAmountTest.java
Expand Up @@ -33,7 +33,7 @@ public void testEnsureMonetaryAmount() {
public void testCurrencyCode() {
for (Class type : MonetaryAmounts.getAmountTypes()) {
for (Currency jdkCur : Currency.getAvailableCurrencies()) {
MonetaryAmount amount = MonetaryAmounts.getAmountFactory()
MonetaryAmount amount = MonetaryAmounts.getAmountFactory(type)
.setCurrency(jdkCur.getCurrencyCode()).setNumber(10.15)
.create();
assertNotNull(amount);
Expand All @@ -56,7 +56,7 @@ public void testWith() {
@Ignore
public void testQuery() {
for (Class type : MonetaryAmounts.getAmountTypes()) {
MonetaryAmount amount = MonetaryAmounts.getAmountFactory()
MonetaryAmount amount = MonetaryAmounts.getAmountFactory(type)
.setCurrency("XXX").setNumber(0).create();
// amount.query();
fail("not implemented.");
Expand All @@ -68,11 +68,11 @@ public void testQuery() {
@Test
public void testImplementsEquals() {
for (Class type : MonetaryAmounts.getAmountTypes()) {
MonetaryAmount amount = MonetaryAmounts.getAmountFactory()
MonetaryAmount amount = MonetaryAmounts.getAmountFactory(type)
.setCurrency("XXX").setNumber(0).create();
ClassTester.testHasPublicStaticMethodOpt(type, type, "equals",
MonetaryOperator.class);
MonetaryAmount amount2 = MonetaryAmounts.getAmountFactory()
MonetaryAmount amount2 = MonetaryAmounts.getAmountFactory(type)
.setCurrency("XXX").setNumber(0).create();
assertEquals(amount, amount2);
}
Expand All @@ -82,11 +82,11 @@ public void testImplementsEquals() {
@Test
public void testImplementsHashCode() {
for (Class type : MonetaryAmounts.getAmountTypes()) {
MonetaryAmount amount = MonetaryAmounts.getAmountFactory()
MonetaryAmount amount = MonetaryAmounts.getAmountFactory(type)
.setCurrency("USD").setNumber(0).create();
ClassTester.testHasPublicStaticMethodOpt(type, type, "hashCode",
MonetaryOperator.class);
MonetaryAmount amount2 = MonetaryAmounts.getAmountFactory()
MonetaryAmount amount2 = MonetaryAmounts.getAmountFactory(type)
.setCurrency("USD").setNumber(0).create();
assertEquals(amount.hashCode(), amount2.hashCode());
}
Expand All @@ -97,21 +97,21 @@ public void testImplementsHashCode() {
public void testImplementComparable() {
for (Class type : MonetaryAmounts.getAmountTypes()) {
ClassTester.testComparable(type);
MonetaryAmount amount = MonetaryAmounts.getAmountFactory()
MonetaryAmount amount = MonetaryAmounts.getAmountFactory(type)
.setCurrency("XXX").setNumber(0).create();
ClassTester.testHasPublicStaticMethodOpt(type, type, "hashCode",
MonetaryOperator.class);
MonetaryAmount amount2 = MonetaryAmounts.getAmountFactory()
MonetaryAmount amount2 = MonetaryAmounts.getAmountFactory(type)
.setCurrency("XXX").setNumber(0).create();
assertTrue("Comparable failed for: " + type.getName(),
((Comparable) amount).compareTo(amount2) == 0);
MonetaryAmount amount3 = MonetaryAmounts.getAmountFactory()
MonetaryAmount amount3 = MonetaryAmounts.getAmountFactory(type)
.setCurrency("CHF").setNumber(1).create();
assertTrue("Comparable failed for: " + type.getName(),
((Comparable) amount).compareTo(amount3) > 0);
assertTrue("Comparable failed for: " + type.getName(),
((Comparable) amount3).compareTo(amount) < 0);
MonetaryAmount amount4 = MonetaryAmounts.getAmountFactory()
MonetaryAmount amount4 = MonetaryAmounts.getAmountFactory(type)
.setCurrency("XXX").setNumber(1).create();
assertTrue("Comparable failed for: " + type.getName(),
((Comparable) amount3).compareTo(amount4) < 0);
Expand Down

0 comments on commit 32fabc7

Please sign in to comment.