Code review updates
This commit is contained in:
parent
fe48be1354
commit
f9c4c24f15
|
@ -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)
|
|
|
@ -8,28 +8,28 @@ public class DoubleToLongUnitTest {
|
||||||
final static double VALUE = 9999.999;
|
final static double VALUE = 9999.999;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void using_longValue() {
|
public void givenDoubleValue_whenLongValueCalled_thenLongValueReturned() {
|
||||||
Assert.assertEquals(9999L, Double.valueOf(VALUE)
|
Assert.assertEquals(9999L, Double.valueOf(VALUE)
|
||||||
.longValue());
|
.longValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void using_Math_Round() {
|
public void givenDoubleValue_whenMathRoundUseds_thenLongValueReturned() {
|
||||||
Assert.assertEquals(10000L, Math.round(VALUE));
|
Assert.assertEquals(10000L, Math.round(VALUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void using_Math_Ceil() {
|
public void givenDoubleValue_whenMathCeilUsed_thenLongValueReturned() {
|
||||||
Assert.assertEquals(10000L, Math.ceil(VALUE), 0);
|
Assert.assertEquals(10000L, Math.ceil(VALUE), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void using_Math_Floor() {
|
public void givenDoubleValue_whenMathFloorUsed_thenLongValueReturned() {
|
||||||
Assert.assertEquals(9999L, Math.floor(VALUE), 0);
|
Assert.assertEquals(9999L, Math.floor(VALUE), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void using_Type_Cast() {
|
public void givenDoubleValue_whenTypeCasted_thenLongValueReturned() {
|
||||||
Assert.assertEquals(9999L, (long) VALUE);
|
Assert.assertEquals(9999L, (long) VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue