Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

Commit 8bdc67d

Browse files
author
Jochen Buchholz
committed
Change test to reproduce the error
1 parent 2819e6c commit 8bdc67d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,12 @@ public void testMultiplyLong(){
409409
assertEquals(FastMoney.of(200, "CHF"), m.multiply(2));
410410
assertEquals(FastMoney.of(new BigDecimal("50.0"), "CHF"), m.multiply(0.5));
411411

412+
// Zero test
413+
m = FastMoney.of(100, "CHF");
414+
assertEquals( m.multiply(0), FastMoney.of(0, "CHF"));
415+
m = FastMoney.of(0, "CHF");
416+
assertEquals( m.multiply(10), FastMoney.of(0, "CHF"));
417+
412418
try {
413419
// the maximum value for FastMoney is 92233720368547.75807 so this should overflow
414420
FastMoney.of(90000000000000L, "CHF").multiply(90000000000000L);
@@ -562,6 +568,9 @@ public void testNegate(){
562568
} catch (ArithmeticException e) {
563569
// should happen
564570
}
571+
572+
m = FastMoney.of(0, "CHF");
573+
assertEquals(m.negate(), FastMoney.of(0, "CHF"));
565574
}
566575

567576
/**

0 commit comments

Comments
 (0)