Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/GillIntegratorTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/GillIntegratorTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/GillIntegratorTest.java (original) +++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/GillIntegratorTest.java Fri Sep 2 15:11:31 2011 @@ -18,10 +18,10 @@ package org.apache.commons.math.ode.nonstiff; +import org.apache.commons.math.exception.DimensionMismatchException; import org.apache.commons.math.exception.MathUserException; import org.apache.commons.math.ode.FirstOrderDifferentialEquations; import org.apache.commons.math.ode.FirstOrderIntegrator; -import org.apache.commons.math.ode.IntegratorException; import org.apache.commons.math.ode.TestProblem1; import org.apache.commons.math.ode.TestProblem3; import org.apache.commons.math.ode.TestProblem5; @@ -29,7 +29,6 @@ import org.apache.commons.math.ode.TestP import org.apache.commons.math.ode.TestProblemFactory; import org.apache.commons.math.ode.TestProblemHandler; import org.apache.commons.math.ode.events.EventHandler; -import org.apache.commons.math.ode.nonstiff.GillIntegrator; import org.apache.commons.math.ode.sampling.StepHandler; import org.apache.commons.math.ode.sampling.StepInterpolator; import org.apache.commons.math.util.FastMath; @@ -38,23 +37,18 @@ import org.junit.Test; public class GillIntegratorTest { - @Test + @Test(expected=DimensionMismatchException.class) public void testDimensionCheck() { - try { TestProblem1 pb = new TestProblem1(); new GillIntegrator(0.01).integrate(pb, 0.0, new double[pb.getDimension()+10], 1.0, new double[pb.getDimension()+10]); Assert.fail("an exception should have been thrown"); - } catch(MathUserException de) { - Assert.fail("wrong exception caught"); - } catch(IntegratorException ie) { - } } @Test public void testDecreasingSteps() - throws MathUserException, IntegratorException { + { TestProblemAbstract[] problems = TestProblemFactory.getProblems(); for (int k = 0; k < problems.length; ++k) { @@ -100,7 +94,7 @@ public class GillIntegratorTest { @Test public void testSmallStep() - throws MathUserException, IntegratorException { + { TestProblem1 pb = new TestProblem1(); double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.001; @@ -120,7 +114,7 @@ public class GillIntegratorTest { @Test public void testBigStep() - throws MathUserException, IntegratorException { + { TestProblem1 pb = new TestProblem1(); double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.2; @@ -139,7 +133,7 @@ public class GillIntegratorTest { @Test public void testBackward() - throws MathUserException, IntegratorException { + { TestProblem5 pb = new TestProblem5(); double step = FastMath.abs(pb.getFinalTime() - pb.getInitialTime()) * 0.001; @@ -158,7 +152,7 @@ public class GillIntegratorTest { @Test public void testKepler() - throws MathUserException, IntegratorException { + { final TestProblem3 pb = new TestProblem3(0.9); double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.0003; @@ -172,7 +166,7 @@ public class GillIntegratorTest { @Test public void testUnstableDerivative() - throws MathUserException, IntegratorException { + { final StepProblem stepProblem = new StepProblem(0.0, 1.0, 2.0); FirstOrderIntegrator integ = new GillIntegrator(0.3); integ.addEventHandler(stepProblem, 1.0, 1.0e-12, 1000); @@ -213,7 +207,7 @@ public class GillIntegratorTest { @Test public void testStepSize() - throws MathUserException, IntegratorException { + { final double step = 1.23456; FirstOrderIntegrator integ = new GillIntegrator(step); integ.addStepHandler(new StepHandler() {
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/GillStepInterpolatorTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/GillStepInterpolatorTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/GillStepInterpolatorTest.java (original) +++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/GillStepInterpolatorTest.java Fri Sep 2 15:11:31 2011 @@ -18,18 +18,15 @@ package org.apache.commons.math.ode.nonstiff; -import java.util.Random; -import java.io.ByteArrayOutputStream; import java.io.ByteArrayInputStream; -import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; +import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.Random; -import org.apache.commons.math.exception.MathUserException; import org.apache.commons.math.ode.ContinuousOutputModel; -import org.apache.commons.math.ode.IntegratorException; import org.apache.commons.math.ode.TestProblem3; -import org.apache.commons.math.ode.nonstiff.GillIntegrator; import org.apache.commons.math.ode.sampling.StepHandler; import org.apache.commons.math.ode.sampling.StepInterpolatorTestUtils; import org.junit.Assert; @@ -39,7 +36,7 @@ public class GillStepInterpolatorTest { @Test public void testDerivativesConsistency() - throws MathUserException, IntegratorException { + { TestProblem3 pb = new TestProblem3(); double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.001; GillIntegrator integ = new GillIntegrator(step); @@ -48,8 +45,7 @@ public class GillStepInterpolatorTest { @Test public void serialization() - throws MathUserException, IntegratorException, - IOException, ClassNotFoundException { + throws IOException, ClassNotFoundException { TestProblem3 pb = new TestProblem3(0.9); double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.0003; Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegratorTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegratorTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegratorTest.java (original) +++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegratorTest.java Fri Sep 2 15:11:31 2011 @@ -17,10 +17,11 @@ package org.apache.commons.math.ode.nonstiff; +import org.apache.commons.math.exception.DimensionMismatchException; import org.apache.commons.math.exception.MathUserException; +import org.apache.commons.math.exception.NumberIsTooSmallException; import org.apache.commons.math.ode.FirstOrderDifferentialEquations; import org.apache.commons.math.ode.FirstOrderIntegrator; -import org.apache.commons.math.ode.IntegratorException; import org.apache.commons.math.ode.TestProblem1; import org.apache.commons.math.ode.TestProblem3; import org.apache.commons.math.ode.TestProblem4; @@ -28,7 +29,6 @@ import org.apache.commons.math.ode.TestP import org.apache.commons.math.ode.TestProblemAbstract; import org.apache.commons.math.ode.TestProblemHandler; import org.apache.commons.math.ode.events.EventHandler; -import org.apache.commons.math.ode.nonstiff.GraggBulirschStoerIntegrator; import org.apache.commons.math.ode.sampling.StepHandler; import org.apache.commons.math.ode.sampling.StepInterpolator; import org.apache.commons.math.util.FastMath; @@ -38,42 +38,29 @@ import org.junit.Test; public class GraggBulirschStoerIntegratorTest { - @Test + @Test(expected=DimensionMismatchException.class) public void testDimensionCheck() { - try { TestProblem1 pb = new TestProblem1(); AdaptiveStepsizeIntegrator integrator = new GraggBulirschStoerIntegrator(0.0, 1.0, 1.0e-10, 1.0e-10); integrator.integrate(pb, 0.0, new double[pb.getDimension()+10], 1.0, new double[pb.getDimension()+10]); - Assert.fail("an exception should have been thrown"); - } catch(MathUserException de) { - Assert.fail("wrong exception caught"); - } catch(IntegratorException ie) { - } } - @Test + @Test(expected=NumberIsTooSmallException.class) public void testNullIntervalCheck() { - try { TestProblem1 pb = new TestProblem1(); GraggBulirschStoerIntegrator integrator = new GraggBulirschStoerIntegrator(0.0, 1.0, 1.0e-10, 1.0e-10); integrator.integrate(pb, 0.0, new double[pb.getDimension()], 0.0, new double[pb.getDimension()]); - Assert.fail("an exception should have been thrown"); - } catch(MathUserException de) { - Assert.fail("wrong exception caught"); - } catch(IntegratorException ie) { - } } - @Test + @Test(expected=NumberIsTooSmallException.class) public void testMinStep() { - try { TestProblem5 pb = new TestProblem5(); double minStep = 0.1 * FastMath.abs(pb.getFinalTime() - pb.getInitialTime()); double maxStep = FastMath.abs(pb.getFinalTime() - pb.getInitialTime()); @@ -88,17 +75,12 @@ public class GraggBulirschStoerIntegrato integ.integrate(pb, pb.getInitialTime(), pb.getInitialState(), pb.getFinalTime(), new double[pb.getDimension()]); - Assert.fail("an exception should have been thrown"); - } catch(MathUserException de) { - Assert.fail("wrong exception caught"); - } catch(IntegratorException ie) { - } } @Test public void testBackward() - throws MathUserException, IntegratorException { + { TestProblem5 pb = new TestProblem5(); double minStep = 0; @@ -122,7 +104,7 @@ public class GraggBulirschStoerIntegrato @Test public void testIncreasingTolerance() - throws MathUserException, IntegratorException { + { int previousCalls = Integer.MAX_VALUE; for (int i = -12; i < -4; ++i) { @@ -160,7 +142,7 @@ public class GraggBulirschStoerIntegrato @Test public void testIntegratorControls() - throws MathUserException, IntegratorException { + { TestProblem3 pb = new TestProblem3(0.999); GraggBulirschStoerIntegrator integ = @@ -189,7 +171,7 @@ public class GraggBulirschStoerIntegrato } private double getMaxError(FirstOrderIntegrator integrator, TestProblemAbstract pb) - throws MathUserException, IntegratorException { + { TestProblemHandler handler = new TestProblemHandler(pb, integrator); integrator.addStepHandler(handler); integrator.integrate(pb, @@ -200,7 +182,7 @@ public class GraggBulirschStoerIntegrato @Test public void testEvents() - throws MathUserException, IntegratorException { + { TestProblem4 pb = new TestProblem4(); double minStep = 0; @@ -233,7 +215,7 @@ public class GraggBulirschStoerIntegrato @Test public void testKepler() - throws MathUserException, IntegratorException { + { final TestProblem3 pb = new TestProblem3(0.9); double minStep = 0; @@ -256,7 +238,7 @@ public class GraggBulirschStoerIntegrato @Test public void testVariableSteps() - throws MathUserException, IntegratorException { + { final TestProblem3 pb = new TestProblem3(0.9); double minStep = 0; @@ -276,7 +258,7 @@ public class GraggBulirschStoerIntegrato @Test public void testUnstableDerivative() - throws MathUserException, IntegratorException { + { final StepProblem stepProblem = new StepProblem(0.0, 1.0, 2.0); FirstOrderIntegrator integ = new GraggBulirschStoerIntegrator(0.1, 10, 1.0e-12, 0.0); @@ -287,7 +269,7 @@ public class GraggBulirschStoerIntegrato } @Test - public void testIssue596() throws MathUserException, IntegratorException { + public void testIssue596() { FirstOrderIntegrator integ = new GraggBulirschStoerIntegrator(1e-10, 100.0, 1e-7, 1e-7); integ.addStepHandler(new StepHandler() { Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerStepInterpolatorTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerStepInterpolatorTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerStepInterpolatorTest.java (original) +++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerStepInterpolatorTest.java Fri Sep 2 15:11:31 2011 @@ -27,7 +27,6 @@ import java.util.Random; import org.apache.commons.math.exception.MathUserException; import org.apache.commons.math.ode.ContinuousOutputModel; -import org.apache.commons.math.ode.IntegratorException; import org.apache.commons.math.ode.TestProblem3; import org.apache.commons.math.ode.sampling.StepHandler; import org.apache.commons.math.ode.sampling.StepInterpolator; @@ -40,7 +39,7 @@ public class GraggBulirschStoerStepInter @Test public void derivativesConsistency() - throws MathUserException, IntegratorException { + { TestProblem3 pb = new TestProblem3(0.9); double minStep = 0; double maxStep = pb.getFinalTime() - pb.getInitialTime(); @@ -55,8 +54,7 @@ public class GraggBulirschStoerStepInter @Test public void serialization() - throws MathUserException, IntegratorException, - IOException, ClassNotFoundException { + throws IOException, ClassNotFoundException { TestProblem3 pb = new TestProblem3(0.9); double minStep = 0; @@ -107,7 +105,7 @@ public class GraggBulirschStoerStepInter @Test public void checklone() - throws MathUserException, IntegratorException { + { TestProblem3 pb = new TestProblem3(0.9); double minStep = 0; double maxStep = pb.getFinalTime() - pb.getInitialTime(); Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/HighamHall54IntegratorTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/HighamHall54IntegratorTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/HighamHall54IntegratorTest.java (original) +++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/HighamHall54IntegratorTest.java Fri Sep 2 15:11:31 2011 @@ -18,18 +18,18 @@ package org.apache.commons.math.ode.nonstiff; -import org.apache.commons.math.exception.util.LocalizedFormats; -import org.apache.commons.math.exception.TooManyEvaluationsException; +import org.apache.commons.math.exception.DimensionMismatchException; import org.apache.commons.math.exception.MathUserException; +import org.apache.commons.math.exception.NumberIsTooSmallException; +import org.apache.commons.math.exception.TooManyEvaluationsException; +import org.apache.commons.math.exception.util.LocalizedFormats; import org.apache.commons.math.ode.FirstOrderDifferentialEquations; import org.apache.commons.math.ode.FirstOrderIntegrator; -import org.apache.commons.math.ode.IntegratorException; import org.apache.commons.math.ode.TestProblem1; import org.apache.commons.math.ode.TestProblem3; import org.apache.commons.math.ode.TestProblem4; import org.apache.commons.math.ode.TestProblem5; import org.apache.commons.math.ode.TestProblemHandler; -import org.apache.commons.math.ode.events.EventException; import org.apache.commons.math.ode.events.EventHandler; import org.apache.commons.math.util.FastMath; import org.junit.Assert; @@ -72,10 +72,9 @@ public class HighamHall54IntegratorTest } - @Test + @Test(expected=NumberIsTooSmallException.class) public void testMinStep() { - try { TestProblem1 pb = new TestProblem1(); double minStep = 0.1 * (pb.getFinalTime() - pb.getInitialTime()); double maxStep = pb.getFinalTime() - pb.getInitialTime(); @@ -91,16 +90,12 @@ public class HighamHall54IntegratorTest pb.getInitialTime(), pb.getInitialState(), pb.getFinalTime(), new double[pb.getDimension()]); Assert.fail("an exception should have been thrown"); - } catch(MathUserException de) { - Assert.fail("wrong exception caught"); - } catch(IntegratorException ie) { - } } @Test public void testIncreasingTolerance() - throws MathUserException, IntegratorException { + { int previousCalls = Integer.MAX_VALUE; for (int i = -12; i < -2; ++i) { @@ -136,7 +131,7 @@ public class HighamHall54IntegratorTest @Test public void testBackward() - throws MathUserException, IntegratorException { + { TestProblem5 pb = new TestProblem5(); double minStep = 0; @@ -160,7 +155,7 @@ public class HighamHall54IntegratorTest @Test public void testEvents() - throws MathUserException, IntegratorException { + { TestProblem4 pb = new TestProblem4(); double minStep = 0; @@ -211,11 +206,11 @@ public class HighamHall54IntegratorTest public int eventOccurred(double t, double[] y, boolean increasing) { return EventHandler.CONTINUE; } - public double g(double t, double[] y) throws EventException { + public double g(double t, double[] y) { double middle = (pb.getInitialTime() + pb.getFinalTime()) / 2; double offset = t - middle; if (offset > 0) { - throw new EventException(LocalizedFormats.EVALUATION_FAILED, t); + throw new MathUserException(LocalizedFormats.EVALUATION_FAILED, t); } return offset; } @@ -228,7 +223,7 @@ public class HighamHall54IntegratorTest pb.getInitialTime(), pb.getInitialState(), pb.getFinalTime(), new double[pb.getDimension()]); Assert.fail("an exception should have been thrown"); - } catch (IntegratorException ie) { + } catch (MathUserException ie) { // expected behavior } @@ -285,7 +280,7 @@ public class HighamHall54IntegratorTest integ.integrate(pb, pb.getInitialTime(), new double[6], pb.getFinalTime(), new double[pb.getDimension()]); Assert.fail("an exception should have been thrown"); - } catch (IntegratorException ie) { + } catch (DimensionMismatchException ie) { // expected behavior } @@ -295,7 +290,7 @@ public class HighamHall54IntegratorTest integ.integrate(pb, pb.getInitialTime(), pb.getInitialState(), pb.getFinalTime(), new double[6]); Assert.fail("an exception should have been thrown"); - } catch (IntegratorException ie) { + } catch (DimensionMismatchException ie) { // expected behavior } @@ -305,7 +300,7 @@ public class HighamHall54IntegratorTest integ.integrate(pb, pb.getInitialTime(), pb.getInitialState(), pb.getFinalTime(), new double[pb.getDimension()]); Assert.fail("an exception should have been thrown"); - } catch (IntegratorException ie) { + } catch (DimensionMismatchException ie) { // expected behavior } @@ -315,7 +310,7 @@ public class HighamHall54IntegratorTest integ.integrate(pb, pb.getInitialTime(), pb.getInitialState(), pb.getFinalTime(), new double[pb.getDimension()]); Assert.fail("an exception should have been thrown"); - } catch (IntegratorException ie) { + } catch (DimensionMismatchException ie) { // expected behavior } @@ -325,7 +320,7 @@ public class HighamHall54IntegratorTest integ.integrate(pb, pb.getInitialTime(), pb.getInitialState(), pb.getInitialTime(), new double[pb.getDimension()]); Assert.fail("an exception should have been thrown"); - } catch (IntegratorException ie) { + } catch (NumberIsTooSmallException ie) { // expected behavior } @@ -333,7 +328,7 @@ public class HighamHall54IntegratorTest @Test public void testKepler() - throws MathUserException, IntegratorException { + { final TestProblem3 pb = new TestProblem3(0.9); double minStep = 0; Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/HighamHall54StepInterpolatorTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/HighamHall54StepInterpolatorTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/HighamHall54StepInterpolatorTest.java (original) +++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/HighamHall54StepInterpolatorTest.java Fri Sep 2 15:11:31 2011 @@ -27,7 +27,6 @@ import java.util.Random; import org.apache.commons.math.exception.MathUserException; import org.apache.commons.math.ode.ContinuousOutputModel; -import org.apache.commons.math.ode.IntegratorException; import org.apache.commons.math.ode.TestProblem3; import org.apache.commons.math.ode.sampling.StepHandler; import org.apache.commons.math.ode.sampling.StepInterpolator; @@ -40,7 +39,7 @@ public class HighamHall54StepInterpolato @Test public void derivativesConsistency() - throws MathUserException, IntegratorException { + { TestProblem3 pb = new TestProblem3(0.1); double minStep = 0; double maxStep = pb.getFinalTime() - pb.getInitialTime(); @@ -54,8 +53,7 @@ public class HighamHall54StepInterpolato @Test public void serialization() - throws MathUserException, IntegratorException, - IOException, ClassNotFoundException { + throws IOException, ClassNotFoundException { TestProblem3 pb = new TestProblem3(0.9); double minStep = 0; @@ -105,7 +103,7 @@ public class HighamHall54StepInterpolato @Test public void checkClone() - throws MathUserException, IntegratorException { + { TestProblem3 pb = new TestProblem3(0.9); double minStep = 0; double maxStep = pb.getFinalTime() - pb.getInitialTime(); Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/MidpointIntegratorTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/MidpointIntegratorTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/MidpointIntegratorTest.java (original) +++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/MidpointIntegratorTest.java Fri Sep 2 15:11:31 2011 @@ -18,17 +18,15 @@ package org.apache.commons.math.ode.nonstiff; -import org.apache.commons.math.exception.MathUserException; +import org.apache.commons.math.exception.DimensionMismatchException; import org.apache.commons.math.ode.FirstOrderDifferentialEquations; import org.apache.commons.math.ode.FirstOrderIntegrator; -import org.apache.commons.math.ode.IntegratorException; import org.apache.commons.math.ode.TestProblem1; import org.apache.commons.math.ode.TestProblem5; import org.apache.commons.math.ode.TestProblemAbstract; import org.apache.commons.math.ode.TestProblemFactory; import org.apache.commons.math.ode.TestProblemHandler; import org.apache.commons.math.ode.events.EventHandler; -import org.apache.commons.math.ode.nonstiff.MidpointIntegrator; import org.apache.commons.math.ode.sampling.StepHandler; import org.apache.commons.math.ode.sampling.StepInterpolator; import org.apache.commons.math.util.FastMath; @@ -37,23 +35,18 @@ import org.junit.Test; public class MidpointIntegratorTest { - @Test + @Test(expected=DimensionMismatchException.class) public void testDimensionCheck() { - try { TestProblem1 pb = new TestProblem1(); new MidpointIntegrator(0.01).integrate(pb, 0.0, new double[pb.getDimension()+10], 1.0, new double[pb.getDimension()+10]); Assert.fail("an exception should have been thrown"); - } catch(MathUserException de) { - Assert.fail("wrong exception caught"); - } catch(IntegratorException ie) { - } } @Test public void testDecreasingSteps() - throws MathUserException, IntegratorException { + { TestProblemAbstract[] problems = TestProblemFactory.getProblems(); for (int k = 0; k < problems.length; ++k) { @@ -99,7 +92,7 @@ public class MidpointIntegratorTest { @Test public void testSmallStep() - throws MathUserException, IntegratorException { + { TestProblem1 pb = new TestProblem1(); double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.001; @@ -120,7 +113,7 @@ public class MidpointIntegratorTest { @Test public void testBigStep() - throws MathUserException, IntegratorException { + { TestProblem1 pb = new TestProblem1(); double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.2; @@ -140,7 +133,7 @@ public class MidpointIntegratorTest { @Test public void testBackward() - throws MathUserException, IntegratorException { + { TestProblem5 pb = new TestProblem5(); double step = FastMath.abs(pb.getFinalTime() - pb.getInitialTime()) * 0.001; @@ -159,7 +152,7 @@ public class MidpointIntegratorTest { @Test public void testStepSize() - throws MathUserException, IntegratorException { + { final double step = 1.23456; FirstOrderIntegrator integ = new MidpointIntegrator(step); integ.addStepHandler(new StepHandler() { Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/MidpointStepInterpolatorTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/MidpointStepInterpolatorTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/MidpointStepInterpolatorTest.java (original) +++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/MidpointStepInterpolatorTest.java Fri Sep 2 15:11:31 2011 @@ -25,9 +25,7 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.Random; -import org.apache.commons.math.exception.MathUserException; import org.apache.commons.math.ode.ContinuousOutputModel; -import org.apache.commons.math.ode.IntegratorException; import org.apache.commons.math.ode.TestProblem1; import org.apache.commons.math.ode.TestProblem3; import org.apache.commons.math.ode.sampling.StepHandler; @@ -39,7 +37,7 @@ public class MidpointStepInterpolatorTes @Test public void testDerivativesConsistency() - throws MathUserException, IntegratorException { + { TestProblem3 pb = new TestProblem3(); double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.001; MidpointIntegrator integ = new MidpointIntegrator(step); @@ -48,8 +46,7 @@ public class MidpointStepInterpolatorTes @Test public void serialization() - throws MathUserException, IntegratorException, - IOException, ClassNotFoundException { + throws IOException, ClassNotFoundException { TestProblem1 pb = new TestProblem1(); double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.001; Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/ThreeEighthesIntegratorTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/ThreeEighthesIntegratorTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/ThreeEighthesIntegratorTest.java (original) +++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/ThreeEighthesIntegratorTest.java Fri Sep 2 15:11:31 2011 @@ -18,10 +18,10 @@ package org.apache.commons.math.ode.nonstiff; +import org.apache.commons.math.exception.DimensionMismatchException; import org.apache.commons.math.exception.MathUserException; import org.apache.commons.math.ode.FirstOrderDifferentialEquations; import org.apache.commons.math.ode.FirstOrderIntegrator; -import org.apache.commons.math.ode.IntegratorException; import org.apache.commons.math.ode.TestProblem1; import org.apache.commons.math.ode.TestProblem3; import org.apache.commons.math.ode.TestProblem5; @@ -29,7 +29,6 @@ import org.apache.commons.math.ode.TestP import org.apache.commons.math.ode.TestProblemFactory; import org.apache.commons.math.ode.TestProblemHandler; import org.apache.commons.math.ode.events.EventHandler; -import org.apache.commons.math.ode.nonstiff.ThreeEighthesIntegrator; import org.apache.commons.math.ode.sampling.StepHandler; import org.apache.commons.math.ode.sampling.StepInterpolator; import org.apache.commons.math.util.FastMath; @@ -38,23 +37,18 @@ import org.junit.Test; public class ThreeEighthesIntegratorTest { - @Test + @Test(expected=DimensionMismatchException.class) public void testDimensionCheck() { - try { TestProblem1 pb = new TestProblem1(); new ThreeEighthesIntegrator(0.01).integrate(pb, 0.0, new double[pb.getDimension()+10], 1.0, new double[pb.getDimension()+10]); Assert.fail("an exception should have been thrown"); - } catch(MathUserException de) { - Assert.fail("wrong exception caught"); - } catch(IntegratorException ie) { - } } @Test public void testDecreasingSteps() - throws MathUserException, IntegratorException { + { TestProblemAbstract[] problems = TestProblemFactory.getProblems(); for (int k = 0; k < problems.length; ++k) { @@ -100,7 +94,7 @@ public class ThreeEighthesIntegratorTest @Test public void testSmallStep() - throws MathUserException, IntegratorException { + { TestProblem1 pb = new TestProblem1(); double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.001; @@ -120,7 +114,7 @@ public class ThreeEighthesIntegratorTest @Test public void testBigStep() - throws MathUserException, IntegratorException { + { TestProblem1 pb = new TestProblem1(); double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.2; @@ -139,7 +133,7 @@ public class ThreeEighthesIntegratorTest @Test public void testBackward() - throws MathUserException, IntegratorException { + { TestProblem5 pb = new TestProblem5(); double step = FastMath.abs(pb.getFinalTime() - pb.getInitialTime()) * 0.001; @@ -158,7 +152,7 @@ public class ThreeEighthesIntegratorTest @Test public void testKepler() - throws MathUserException, IntegratorException { + { final TestProblem3 pb = new TestProblem3(0.9); double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.0003; @@ -207,7 +201,7 @@ public class ThreeEighthesIntegratorTest @Test public void testStepSize() - throws MathUserException, IntegratorException { + { final double step = 1.23456; FirstOrderIntegrator integ = new ThreeEighthesIntegrator(step); integ.addStepHandler(new StepHandler() { Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/ThreeEighthesStepInterpolatorTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/ThreeEighthesStepInterpolatorTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/ThreeEighthesStepInterpolatorTest.java (original) +++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/ThreeEighthesStepInterpolatorTest.java Fri Sep 2 15:11:31 2011 @@ -25,9 +25,7 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.Random; -import org.apache.commons.math.exception.MathUserException; import org.apache.commons.math.ode.ContinuousOutputModel; -import org.apache.commons.math.ode.IntegratorException; import org.apache.commons.math.ode.TestProblem3; import org.apache.commons.math.ode.sampling.StepHandler; import org.apache.commons.math.ode.sampling.StepInterpolatorTestUtils; @@ -38,7 +36,7 @@ public class ThreeEighthesStepInterpolat @Test public void derivativesConsistency() - throws MathUserException, IntegratorException { + { TestProblem3 pb = new TestProblem3(); double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.001; ThreeEighthesIntegrator integ = new ThreeEighthesIntegrator(step); @@ -47,8 +45,7 @@ public class ThreeEighthesStepInterpolat @Test public void serialization() - throws MathUserException, IntegratorException, - IOException, ClassNotFoundException { + throws IOException, ClassNotFoundException { TestProblem3 pb = new TestProblem3(0.9); double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.0003; Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/sampling/NordsieckStepInterpolatorTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/sampling/NordsieckStepInterpolatorTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/sampling/NordsieckStepInterpolatorTest.java (original) +++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/sampling/NordsieckStepInterpolatorTest.java Fri Sep 2 15:11:31 2011 @@ -25,9 +25,7 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.Random; -import org.apache.commons.math.exception.MathUserException; import org.apache.commons.math.ode.ContinuousOutputModel; -import org.apache.commons.math.ode.IntegratorException; import org.apache.commons.math.ode.TestProblem1; import org.apache.commons.math.ode.TestProblem3; import org.apache.commons.math.ode.nonstiff.AdamsBashforthIntegrator; @@ -37,8 +35,7 @@ import org.junit.Test; public class NordsieckStepInterpolatorTest { @Test - public void derivativesConsistency() - throws MathUserException, IntegratorException { + public void derivativesConsistency() { TestProblem3 pb = new TestProblem3(); AdamsBashforthIntegrator integ = new AdamsBashforthIntegrator(4, 0.0, 1.0, 1.0e-10, 1.0e-10); StepInterpolatorTestUtils.checkDerivativesConsistency(integ, pb, 5e-9); @@ -46,8 +43,7 @@ public class NordsieckStepInterpolatorTe @Test public void serialization() - throws MathUserException, IntegratorException, - IOException, ClassNotFoundException { + throws IOException, ClassNotFoundException { TestProblem1 pb = new TestProblem1(); AdamsBashforthIntegrator integ = new AdamsBashforthIntegrator(4, 0.0, 1.0, 1.0e-10, 1.0e-10); Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/sampling/StepInterpolatorTestUtils.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/sampling/StepInterpolatorTestUtils.java?rev=1164573&r1=1164572&r2=1164573&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/sampling/StepInterpolatorTestUtils.java (original) +++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/sampling/StepInterpolatorTestUtils.java Fri Sep 2 15:11:31 2011 @@ -19,7 +19,6 @@ package org.apache.commons.math.ode.samp import org.apache.commons.math.exception.MathUserException; import org.apache.commons.math.ode.FirstOrderIntegrator; -import org.apache.commons.math.ode.IntegratorException; import org.apache.commons.math.ode.TestProblemAbstract; import org.apache.commons.math.util.FastMath; import org.junit.Assert; @@ -28,8 +27,7 @@ public class StepInterpolatorTestUtils { public static void checkDerivativesConsistency(final FirstOrderIntegrator integrator, final TestProblemAbstract problem, - final double threshold) - throws MathUserException, IntegratorException { + final double threshold) { integrator.addStepHandler(new StepHandler() { public void handleStep(StepInterpolator interpolator, boolean isLast) Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/sampling/StepNormalizerOutputTestBase.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/sampling/StepNormalizerOutputTestBase.java?rev=1164573&r1=1164572&r2=1164573&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/sampling/StepNormalizerOutputTestBase.java (original) +++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/sampling/StepNormalizerOutputTestBase.java Fri Sep 2 15:11:31 2011 @@ -8,7 +8,6 @@ import java.util.List; import org.apache.commons.math.exception.MathUserException; import org.apache.commons.math.ode.FirstOrderDifferentialEquations; import org.apache.commons.math.ode.FirstOrderIntegrator; -import org.apache.commons.math.ode.IntegratorException; import org.apache.commons.math.ode.nonstiff.GraggBulirschStoerIntegrator; import org.junit.Test; @@ -81,97 +80,97 @@ public abstract class StepNormalizerOutp } @Test - public void testIncNeither() throws MathUserException, IntegratorException { + public void testIncNeither() { double[] exp = getArray(getExpInc(), getO()[0][0], getO()[0][1]); doTest(StepNormalizerMode.INCREMENT, StepNormalizerBounds.NEITHER, exp, false); } @Test - public void testIncNeitherRev() throws MathUserException, IntegratorException { + public void testIncNeitherRev() { double[] exp = getArray(getExpIncRev(), getO()[1][0], getO()[1][1]); doTest(StepNormalizerMode.INCREMENT, StepNormalizerBounds.NEITHER, exp, true); } @Test - public void testIncFirst() throws MathUserException, IntegratorException { + public void testIncFirst() { double[] exp = getArray(getExpInc(), getO()[2][0], getO()[2][1]); doTest(StepNormalizerMode.INCREMENT, StepNormalizerBounds.FIRST, exp, false); } @Test - public void testIncFirstRev() throws MathUserException, IntegratorException { + public void testIncFirstRev() { double[] exp = getArray(getExpIncRev(), getO()[3][0], getO()[3][1]); doTest(StepNormalizerMode.INCREMENT, StepNormalizerBounds.FIRST, exp, true); } @Test - public void testIncLast() throws MathUserException, IntegratorException { + public void testIncLast() { double[] exp = getArray(getExpInc(), getO()[4][0], getO()[4][1]); doTest(StepNormalizerMode.INCREMENT, StepNormalizerBounds.LAST, exp, false); } @Test - public void testIncLastRev() throws MathUserException, IntegratorException { + public void testIncLastRev() { double[] exp = getArray(getExpIncRev(), getO()[5][0], getO()[5][1]); doTest(StepNormalizerMode.INCREMENT, StepNormalizerBounds.LAST, exp, true); } @Test - public void testIncBoth() throws MathUserException, IntegratorException { + public void testIncBoth() { double[] exp = getArray(getExpInc(), getO()[6][0], getO()[6][1]); doTest(StepNormalizerMode.INCREMENT, StepNormalizerBounds.BOTH, exp, false); } @Test - public void testIncBothRev() throws MathUserException, IntegratorException { + public void testIncBothRev() { double[] exp = getArray(getExpIncRev(), getO()[7][0], getO()[7][1]); doTest(StepNormalizerMode.INCREMENT, StepNormalizerBounds.BOTH, exp, true); } @Test - public void testMulNeither() throws MathUserException, IntegratorException { + public void testMulNeither() { double[] exp = getArray(getExpMul(), getO()[8][0], getO()[8][1]); doTest(StepNormalizerMode.MULTIPLES, StepNormalizerBounds.NEITHER, exp, false); } @Test - public void testMulNeitherRev() throws MathUserException, IntegratorException { + public void testMulNeitherRev() { double[] exp = getArray(getExpMulRev(), getO()[9][0], getO()[9][1]); doTest(StepNormalizerMode.MULTIPLES, StepNormalizerBounds.NEITHER, exp, true); } @Test - public void testMulFirst() throws MathUserException, IntegratorException { + public void testMulFirst() { double[] exp = getArray(getExpMul(), getO()[10][0], getO()[10][1]); doTest(StepNormalizerMode.MULTIPLES, StepNormalizerBounds.FIRST, exp, false); } @Test - public void testMulFirstRev() throws MathUserException, IntegratorException { + public void testMulFirstRev() { double[] exp = getArray(getExpMulRev(), getO()[11][0], getO()[11][1]); doTest(StepNormalizerMode.MULTIPLES, StepNormalizerBounds.FIRST, exp, true); } @Test - public void testMulLast() throws MathUserException, IntegratorException { + public void testMulLast() { double[] exp = getArray(getExpMul(), getO()[12][0], getO()[12][1]); doTest(StepNormalizerMode.MULTIPLES, StepNormalizerBounds.LAST, exp, false); } @Test - public void testMulLastRev() throws MathUserException, IntegratorException { + public void testMulLastRev() { double[] exp = getArray(getExpMulRev(), getO()[13][0], getO()[13][1]); doTest(StepNormalizerMode.MULTIPLES, StepNormalizerBounds.LAST, exp, true); } @Test - public void testMulBoth() throws MathUserException, IntegratorException { + public void testMulBoth() { double[] exp = getArray(getExpMul(), getO()[14][0], getO()[14][1]); doTest(StepNormalizerMode.MULTIPLES, StepNormalizerBounds.BOTH, exp, false); } @Test - public void testMulBothRev() throws MathUserException, IntegratorException { + public void testMulBothRev() { double[] exp = getArray(getExpMulRev(), getO()[15][0], getO()[15][1]); doTest(StepNormalizerMode.MULTIPLES, StepNormalizerBounds.BOTH, exp, true); } @@ -186,9 +185,7 @@ public abstract class StepNormalizerOutp * @param reverse whether to reverse the integration direction */ private void doTest(StepNormalizerMode mode, StepNormalizerBounds bounds, - double[] expected, boolean reverse) - throws MathUserException, IntegratorException - { + double[] expected, boolean reverse) { // Forward test. FirstOrderIntegrator integ = new GraggBulirschStoerIntegrator( 1e-8, 1.0, 1e-5, 1e-5); Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/sampling/StepNormalizerTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/sampling/StepNormalizerTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/sampling/StepNormalizerTest.java (original) +++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/sampling/StepNormalizerTest.java Fri Sep 2 15:11:31 2011 @@ -17,13 +17,9 @@ package org.apache.commons.math.ode.sampling; -import org.apache.commons.math.exception.MathUserException; import org.apache.commons.math.ode.FirstOrderIntegrator; -import org.apache.commons.math.ode.IntegratorException; import org.apache.commons.math.ode.TestProblem3; import org.apache.commons.math.ode.nonstiff.DormandPrince54Integrator; -import org.apache.commons.math.ode.sampling.FixedStepHandler; -import org.apache.commons.math.ode.sampling.StepNormalizer; import org.apache.commons.math.util.FastMath; import org.junit.After; import org.junit.Assert; @@ -40,7 +36,7 @@ public class StepNormalizerTest { @Test public void testBoundaries() - throws MathUserException, IntegratorException { + { double range = pb.getFinalTime() - pb.getInitialTime(); setLastSeen(false); integ.addStepHandler(new StepNormalizer(range / 10.0, @@ -68,7 +64,7 @@ public class StepNormalizerTest { @Test public void testBeforeEnd() - throws MathUserException, IntegratorException { + { final double range = pb.getFinalTime() - pb.getInitialTime(); setLastSeen(false); integ.addStepHandler(new StepNormalizer(range / 10.5,
