File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
core-java-modules/core-java-numbers-5/src/test/java/com/baeldung/bigdecimaltimesint Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .baeldung .bigdecimaltimesint ;
2+
3+ import static org .assertj .core .api .Assertions .assertThat ;
4+ import static org .junit .jupiter .api .Assertions .assertEquals ;
5+
6+ import java .math .BigDecimal ;
7+
8+ import org .junit .jupiter .api .Test ;
9+
10+ public class BigDecimalxIntegerUnitTest {
11+ private static final BigDecimal BIG = new BigDecimal ("42.42" );
12+ private static final int INT = 10 ;
13+ private static final BigDecimal EXPECTED = new BigDecimal ("424.2" );
14+
15+ @ Test
16+ void givenBigDecimalAndInt_whenTimes_thenGetExpectedResult () {
17+ BigDecimal result = BIG .multiply (BigDecimal .valueOf (INT ));
18+
19+ assertEquals (0 , EXPECTED .compareTo (result ));
20+ assertThat (result ).isEqualByComparingTo (EXPECTED );
21+ }
22+ }
You can’t perform that action at this time.
0 commit comments