commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aherb...@apache.org
Subject [commons-numbers] 04/08: Explicit test for divide by zero in fraction constructor
Date Wed, 08 Apr 2020 21:17:22 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 d293dd0bdb5faa2e33fcf75c7a1097634244631f
Author: Alex Herbert <aherbert@apache.org>
AuthorDate: Wed Apr 8 21:53:42 2020 +0100

    Explicit test for divide by zero in fraction constructor
---
 .../test/java/org/apache/commons/numbers/fraction/FractionTest.java    | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/commons-numbers-fraction/src/test/java/org/apache/commons/numbers/fraction/FractionTest.java
b/commons-numbers-fraction/src/test/java/org/apache/commons/numbers/fraction/FractionTest.java
index 4c5f847..e075d56 100644
--- a/commons-numbers-fraction/src/test/java/org/apache/commons/numbers/fraction/FractionTest.java
+++ b/commons-numbers-fraction/src/test/java/org/apache/commons/numbers/fraction/FractionTest.java
@@ -49,6 +49,9 @@ public class FractionTest {
         assertFraction(1, Integer.MIN_VALUE, Fraction.of(1, Integer.MIN_VALUE));
         assertFraction(-1, Integer.MIN_VALUE, Fraction.of(-1, Integer.MIN_VALUE));
         assertFraction(1, 1, Fraction.of(Integer.MIN_VALUE, Integer.MIN_VALUE));
+
+        // Divide by zero
+        Assertions.assertThrows(ArithmeticException.class, () -> Fraction.of(1, 0));
     }
 
     @Test


Mime
View raw message