commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1167217 - /commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizerTest.java
Date Fri, 09 Sep 2011 14:35:01 GMT
Author: erans
Date: Fri Sep  9 14:35:00 2011
New Revision: 1167217

URL: http://svn.apache.org/viewvc?rev=1167217&view=rev
Log:
Using Junit4 annotation instead of explicit try/catch.

Modified:
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizerTest.java

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizerTest.java?rev=1167217&r1=1167216&r2=1167217&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizerTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizerTest.java
Fri Sep  9 14:35:00 2011
@@ -202,9 +202,8 @@ public class LevenbergMarquardtOptimizer
         Assert.assertEquals( 1.0 - epsilon, optimum.getPoint()[5], 1.0e-10);
     }
 
-    @Test
+    @Test(expected=SingularMatrixException.class)
     public void testNonInvertible() {
-
         LinearProblem problem = new LinearProblem(new double[][] {
                 {  1, 2, -3 },
                 {  2, 1,  3 },
@@ -212,14 +211,13 @@ public class LevenbergMarquardtOptimizer
         }, new double[] { 1, 1, 1 });
 
         LevenbergMarquardtOptimizer optimizer = new LevenbergMarquardtOptimizer();
-        optimizer.optimize(100, problem, problem.target, new double[] { 1, 1, 1 }, new double[]
{ 0, 0, 0 });
+        VectorialPointValuePair optimum
+            = optimizer.optimize(100, problem, problem.target,
+                                 new double[] { 1, 1, 1 },
+                                 new double[] { 0, 0, 0 });
         Assert.assertTrue(FastMath.sqrt(problem.target.length) * optimizer.getRMS() >
0.6);
-        try {
-            optimizer.getCovariances();
-            Assert.fail("an exception should have been thrown");
-        } catch (SingularMatrixException ee) {
-            // expected behavior
-        }
+
+        final double[][] m = optimizer.getCovariances();
     }
 
     @Test



Mime
View raw message