You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2018/11/30 14:00:27 UTC

[7/8] commons-numbers git commit: Simplify unit tests.

Simplify unit tests.


Project: http://git-wip-us.apache.org/repos/asf/commons-numbers/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-numbers/commit/f4bafc24
Tree: http://git-wip-us.apache.org/repos/asf/commons-numbers/tree/f4bafc24
Diff: http://git-wip-us.apache.org/repos/asf/commons-numbers/diff/f4bafc24

Branch: refs/heads/master
Commit: f4bafc24f3267340e00e39ee4983e349361bb4c0
Parents: daa6a06
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
Authored: Fri Nov 30 14:02:45 2018 +0100
Committer: Gilles Sadowski <gi...@harfang.homelinux.org>
Committed: Fri Nov 30 14:02:45 2018 +0100

----------------------------------------------------------------------
 .../numbers/quaternion/QuaternionTest.java      | 63 +++++---------------
 1 file changed, 14 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/f4bafc24/commons-numbers-quaternion/src/test/java/org/apache/commons/numbers/quaternion/QuaternionTest.java
----------------------------------------------------------------------
diff --git a/commons-numbers-quaternion/src/test/java/org/apache/commons/numbers/quaternion/QuaternionTest.java b/commons-numbers-quaternion/src/test/java/org/apache/commons/numbers/quaternion/QuaternionTest.java
index fa2f342..9dc3074 100644
--- a/commons-numbers-quaternion/src/test/java/org/apache/commons/numbers/quaternion/QuaternionTest.java
+++ b/commons-numbers-quaternion/src/test/java/org/apache/commons/numbers/quaternion/QuaternionTest.java
@@ -527,74 +527,39 @@ public class QuaternionTest {
         Assert.assertEquals(-0xa.cp0, parsed.getQ3(), EPS);
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException.class)
     public final void testParseMissingStart() {
-        try {
-            final Quaternion parsed = Quaternion.parse("1.0 2.0 3.0 4.0]");
-            Assert.fail("expecting QuaternionParsingException but got : " + parsed);
-        } catch (Quaternion.QuaternionParsingException ex) {
-            // expected
-        }
+        Quaternion.parse("1.0 2.0 3.0 4.0]");
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException.class)
     public final void testParseMissingEnd() {
-        try {
-            final Quaternion parsed = Quaternion.parse("[1.0 2.0 3.0 4.0");
-            Assert.fail("expecting QuaternionParsingException but got : " + parsed);
-        } catch (Quaternion.QuaternionParsingException ex) {
-            // expected
-        }
+        Quaternion.parse("[1.0 2.0 3.0 4.0");
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException.class)
     public final void testParseMissingPart() {
-        try {
-            final Quaternion parsed = Quaternion.parse("[1.0 2.0 3.0 ]");
-            Assert.fail("expecting QuaternionParsingException but got : " + parsed);
-        } catch (Quaternion.QuaternionParsingException ex) {
-            // expected
-        }
+        Quaternion.parse("[1.0 2.0 3.0 ]");
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException.class)
     public final void testParseInvalidScalar() {
-        try {
-            final Quaternion parsed = Quaternion.parse("[1.x 2.0 3.0 4.0]");
-            Assert.fail("expecting QuaternionParsingException but got : " + parsed);
-        } catch (Quaternion.QuaternionParsingException ex) {
-            // expected
-        }
+        Quaternion.parse("[1.x 2.0 3.0 4.0]");
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException.class)
     public final void testParseInvalidI() {
-        try {
-            final Quaternion parsed = Quaternion.parse("[1.0 2.0x 3.0 4.0]");
-            Assert.fail("expecting QuaternionParsingException but got : " + parsed);
-        } catch (Quaternion.QuaternionParsingException ex) {
-            // expected
-        }
+        Quaternion.parse("[1.0 2.0x 3.0 4.0]");
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException.class)
     public final void testParseInvalidJ() {
-        try {
-            final Quaternion parsed = Quaternion.parse("[1.0 2.0 3.0x 4.0]");
-            Assert.fail("expecting QuaternionParsingException but got : " + parsed);
-        } catch (Quaternion.QuaternionParsingException ex) {
-            // expected
-        }
+        Quaternion.parse("[1.0 2.0 3.0x 4.0]");
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException.class)
     public final void testParseInvalidK() {
-        try {
-            final Quaternion parsed = Quaternion.parse("[1.0 2.0 3.0 4.0x]");
-            Assert.fail("expecting QuaternionParsingException but got : " + parsed);
-        } catch (Quaternion.QuaternionParsingException ex) {
-            // expected
-        }
+        Quaternion.parse("[1.0 2.0 3.0 4.0x]");
     }
 
     @Test