How do force BigDecimal from rounding in JUnit assertEquals?

Viewed 7824

Everytime I run my assertEquals, my expected BigDecimal is being rounded which causes it to fail. How do I make sure it doesn't round or is there another way?

@Test
public void test() {
    BigDecimal amount = BigDecimal.valueOf(1000);
    BigDecimal interestRate = BigDecimal.valueOf(10);
    BigDecimal years = BigDecimal.valueOf(10);
    InterestCalculator ic = new InterestCalculate(amount, interestRate, years);
    BigDecimal expected = BigDecimal.valueOf(1321.507369947139705200000);
    assertEquals(expected, ic.getMonthlyPaymentAmount());
}
1 Answers
Related