Skip to content

Commit 92e727f

Browse files
author
otaviojava
committed
Adds tests to others implementations to JAVAMONEY-93
1 parent 36cae6b commit 92e727f

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/test/java/org/javamoney/moneta/MoneyTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,4 +1167,19 @@ public void testDivide_WrongCurrency() {
11671167
Money m2 = Money.of(BigDecimal.TEN, "CHF");
11681168
m1.subtract(m2);
11691169
}
1170+
1171+
@Test(expectedExceptions = ArithmeticException.class)
1172+
public void testCreatingFromDoubleNan(){
1173+
Money.of(Double.NaN, "XXX");
1174+
}
1175+
1176+
@Test(expectedExceptions = ArithmeticException.class)
1177+
public void testCreatingFromDoublePositiveInfinity(){
1178+
Money.of(Double.POSITIVE_INFINITY, "XXX");
1179+
}
1180+
1181+
@Test(expectedExceptions = ArithmeticException.class)
1182+
public void testCreatingFromDoubleNegativeInfinity(){
1183+
Money.of(Double.NEGATIVE_INFINITY, "XXX");
1184+
}
11701185
}

src/test/java/org/javamoney/moneta/RoundedMoneyTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,4 +1109,19 @@ public void testDivide_WrongCurrency() {
11091109
m1.subtract(m2);
11101110
}
11111111

1112+
@Test(expectedExceptions = ArithmeticException.class)
1113+
public void testCreatingFromDoubleNan(){
1114+
RoundedMoney.of(Double.NaN, "XXX");
1115+
}
1116+
1117+
@Test(expectedExceptions = ArithmeticException.class)
1118+
public void testCreatingFromDoublePositiveInfinity(){
1119+
RoundedMoney.of(Double.POSITIVE_INFINITY, "XXX");
1120+
}
1121+
1122+
@Test(expectedExceptions = ArithmeticException.class)
1123+
public void testCreatingFromDoubleNegativeInfinity(){
1124+
RoundedMoney.of(Double.NEGATIVE_INFINITY, "XXX");
1125+
}
1126+
11121127
}

0 commit comments

Comments
 (0)