diff --git a/java-numbers-3/pom.xml b/java-numbers-3/pom.xml
index 0559bf2c34..3dd8e16bc7 100644
--- a/java-numbers-3/pom.xml
+++ b/java-numbers-3/pom.xml
@@ -3,7 +3,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
java-numbers-3
- 0.0.1-SNAPSHOT
java-numbers-3
jar
@@ -13,7 +12,6 @@
0.0.1-SNAPSHOT
../parent-java
-
java-numbers-3
diff --git a/java-numbers-3/src/main/java/com/baeldung/doubletolong/DoubleToLongUnitTest.java b/java-numbers-3/src/main/java/com/baeldung/doubletolong/DoubleToLongUnitTest.java
deleted file mode 100644
index a2e8406396..0000000000
--- a/java-numbers-3/src/main/java/com/baeldung/doubletolong/DoubleToLongUnitTest.java
+++ /dev/null
@@ -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);
- }
-
-}
diff --git a/java-numbers-3/src/test/java/com/baeldung/doubletolong/DoubleToLongUnitTest.java b/java-numbers-3/src/test/java/com/baeldung/doubletolong/DoubleToLongUnitTest.java
new file mode 100644
index 0000000000..702c59c12b
--- /dev/null
+++ b/java-numbers-3/src/test/java/com/baeldung/doubletolong/DoubleToLongUnitTest.java
@@ -0,0 +1,64 @@
+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_whenMathRoundUsed_thenRoundUp() {
+ Assert.assertEquals(10000L, Math.round(VALUE));
+ }
+
+ @Test
+ public void givenDoubleValue_whenMathRoundUsed_thenRoundDown() {
+ Assert.assertEquals(9999L, Math.round(9999.444));
+ }
+
+ @Test
+ public void givenDoubleValue_whenMathRoundUsed_thenSameValueReturned() {
+ Assert.assertEquals(9999L, Math.round(9999.0));
+ }
+
+ @Test
+ public void givenDoubleValue_whenMathCeilUsed_thenLongValueReturned() {
+ Assert.assertEquals(10000L, Math.ceil(VALUE), 0);
+ }
+
+ @Test
+ public void givenDoubleValue_whenMathCeilUsed_thenSameValueReturned() {
+ Assert.assertEquals(9999L, Math.ceil(9999.0), 0);
+ }
+
+ @Test
+ public void givenDoubleValue_whenMathCeilUsed_thenDifferentThanRound() {
+ Assert.assertEquals(10000L, Math.ceil(9999.444), 0);
+ }
+
+ @Test
+ public void givenDoubleValue_whenMathFloorUsed_thenLongValueReturned() {
+ Assert.assertEquals(9999L, Math.floor(VALUE), 0);
+ }
+
+ @Test
+ public void givenDoubleValue_whenMathFloorUsed_thenSameValueReturned() {
+ Assert.assertEquals(9999L, Math.floor(9999.0), 0);
+ }
+
+ @Test
+ public void givenDoubleValue_whenMathFloorUsed_thenDifferentThanCeil() {
+ Assert.assertEquals(9999L, Math.floor(9999.444), 0);
+ }
+
+ @Test
+ public void givenDoubleValue_whenTypeCasted_thenLongValueReturned() {
+ Assert.assertEquals(9999L, (long) VALUE);
+ }
+}
diff --git a/pom.xml b/pom.xml
index 9c95ba261c..cb2fe5a929 100644
--- a/pom.xml
+++ b/pom.xml
@@ -512,6 +512,7 @@
java-math-2
java-numbers
java-numbers-2
+ java-numbers-3
java-rmi
java-spi
java-vavr-stream
@@ -1146,6 +1147,7 @@
java-math-2
java-numbers
java-numbers-2
+ java-numbers-3
java-rmi
java-spi
java-vavr-stream