commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aherb...@apache.org
Subject [commons-numbers] 03/06: Fix coverage in PlaneAngleTest
Date Sun, 05 Apr 2020 12:44:08 GMT
This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-numbers.git

commit 62c24fed077ec869a5d0b5fd4a32694891ff61a6
Author: Alex Herbert <aherbert@apache.org>
AuthorDate: Sun Apr 5 12:26:00 2020 +0100

    Fix coverage in PlaneAngleTest
---
 .../commons/numbers/angle/PlaneAngleTest.java      | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/commons-numbers-angle/src/test/java/org/apache/commons/numbers/angle/PlaneAngleTest.java
b/commons-numbers-angle/src/test/java/org/apache/commons/numbers/angle/PlaneAngleTest.java
index 570edba..5cd2039 100644
--- a/commons-numbers-angle/src/test/java/org/apache/commons/numbers/angle/PlaneAngleTest.java
+++ b/commons-numbers-angle/src/test/java/org/apache/commons/numbers/angle/PlaneAngleTest.java
@@ -160,24 +160,14 @@ public class PlaneAngleTest {
     }
 
     @Test
-    public void testEquals1() {
+    public void testEquals() {
         final double value = 12345.6789;
         final PlaneAngle a = PlaneAngle.ofRadians(value);
-        final PlaneAngle b = PlaneAngle.ofRadians(value);
-        Assertions.assertEquals(a, b);
-    }
-    @Test
-    public void testEquals2() {
-        final PlaneAngle a = PlaneAngle.ofRadians(153768.373486587);
-        final PlaneAngle b = null;
-        Assertions.assertFalse(a.equals(b));
-    }
-    @Test
-    public void testEquals3() {
-        final double value = 0.987654321;
-        final PlaneAngle a = PlaneAngle.ofRadians(value);
-        final PlaneAngle b = PlaneAngle.ofRadians(value + 1e-16);
-        Assertions.assertNotEquals(a, b);
+        Assertions.assertTrue(a.equals(a));
+        Assertions.assertTrue(a.equals(PlaneAngle.ofRadians(value)));
+        Assertions.assertFalse(a.equals(PlaneAngle.ofRadians(Math.nextUp(value))));
+        Assertions.assertFalse(a.equals(new Object()));
+        Assertions.assertFalse(a.equals(null));
     }
 
     @Test


Mime
View raw message