Code review updates

This commit is contained in:
sreekanth.nair 2019-12-31 19:25:24 +05:30
parent fe48be1354
commit f9c4c24f15
3 changed files with 5 additions and 12 deletions

View File

@ -1,7 +0,0 @@
## Java Number Cookbooks and Examples
This module contains articles about numbers in Java.
### Relevant Articles
- [Convert Double to Long in Java]s
- More articles: [[<-- prev]](/../java-numbers)

View File

@ -8,28 +8,28 @@ public class DoubleToLongUnitTest {
final static double VALUE = 9999.999;
@Test
public void using_longValue() {
public void givenDoubleValue_whenLongValueCalled_thenLongValueReturned() {
Assert.assertEquals(9999L, Double.valueOf(VALUE)
.longValue());
}
@Test
public void using_Math_Round() {
public void givenDoubleValue_whenMathRoundUseds_thenLongValueReturned() {
Assert.assertEquals(10000L, Math.round(VALUE));
}
@Test
public void using_Math_Ceil() {
public void givenDoubleValue_whenMathCeilUsed_thenLongValueReturned() {
Assert.assertEquals(10000L, Math.ceil(VALUE), 0);
}
@Test
public void using_Math_Floor() {
public void givenDoubleValue_whenMathFloorUsed_thenLongValueReturned() {
Assert.assertEquals(9999L, Math.floor(VALUE), 0);
}
@Test
public void using_Type_Cast() {
public void givenDoubleValue_whenTypeCasted_thenLongValueReturned() {
Assert.assertEquals(9999L, (long) VALUE);
}