File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
java-numbers-3/src/test/java/com/baeldung/doubletolong Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ public void givenDoubleValue_whenLongValueCalled_thenLongValueReturned() {
1313 }
1414
1515 @ Test
16- public void givenDoubleValue_whenMathRoundUsed_thenLongValueReturned () {
16+ public void givenDoubleValue_whenMathRoundUsed_thenRoundUp () {
1717 Assert .assertEquals (10000L , Math .round (VALUE ));
1818 }
1919
@@ -22,6 +22,11 @@ public void givenDoubleValue_whenMathRoundUsed_thenRoundDown() {
2222 Assert .assertEquals (9999L , Math .round (9999.444 ));
2323 }
2424
25+ @ Test
26+ public void givenDoubleValue_whenMathRoundUsed_thenSameValueReturned () {
27+ Assert .assertEquals (9999L , Math .round (9999.0 ));
28+ }
29+
2530 @ Test
2631 public void givenDoubleValue_whenMathCeilUsed_thenLongValueReturned () {
2732 Assert .assertEquals (10000L , Math .ceil (VALUE ), 0 );
@@ -47,6 +52,11 @@ public void givenDoubleValue_whenMathFloorUsed_thenSameValueReturned() {
4752 Assert .assertEquals (9999L , Math .floor (9999.0 ), 0 );
4853 }
4954
55+ @ Test
56+ public void givenDoubleValue_whenMathFloorUsed_thenDifferentThanCeil () {
57+ Assert .assertEquals (9999L , Math .floor (9999.444 ), 0 );
58+ }
59+
5060 @ Test
5161 public void givenDoubleValue_whenTypeCasted_thenLongValueReturned () {
5262 Assert .assertEquals (9999L , (long ) VALUE );
You can’t perform that action at this time.
0 commit comments