BAEL-3517: Code Review Feedback Applied

This commit is contained in:
eric-martin
2020-01-01 16:59:11 -06:00
parent 369e95b8ca
commit 60880ad401
3 changed files with 24 additions and 6 deletions
@@ -1,36 +0,0 @@
package com.baeldung.doubletolong;
import org.junit.Assert;
import org.junit.Test;
public class DoubleToLongUnitTest {
final static double VALUE = 9999.999;
@Test
public void givenDoubleValue_whenLongValueCalled_thenLongValueReturned() {
Assert.assertEquals(9999L, Double.valueOf(VALUE)
.longValue());
}
@Test
public void givenDoubleValue_whenMathRoundUseds_thenLongValueReturned() {
Assert.assertEquals(10000L, Math.round(VALUE));
}
@Test
public void givenDoubleValue_whenMathCeilUsed_thenLongValueReturned() {
Assert.assertEquals(10000L, Math.ceil(VALUE), 0);
}
@Test
public void givenDoubleValue_whenMathFloorUsed_thenLongValueReturned() {
Assert.assertEquals(9999L, Math.floor(VALUE), 0);
}
@Test
public void givenDoubleValue_whenTypeCasted_thenLongValueReturned() {
Assert.assertEquals(9999L, (long) VALUE);
}
}