1 /*
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one or more
4 * contributor license agreements. See the NOTICE file distributed with
5 * this work for additional information regarding copyright ownership.
6 * The ASF licenses this file to You under the Apache License, Version 2.0
7 * (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19 package org.apache.commons.math.analysis.solvers;
20
21 import junit.framework.TestCase;
22
23 /**
24 * @version $Revision: 799857 $ $Date: 2009-08-01 09:07:12 -0400 (Sat, 01 Aug 2009) $
25 */
26 public class UnivariateRealSolverFactoryImplTest extends TestCase {
27
28 /** solver factory */
29 private UnivariateRealSolverFactory factory;
30
31 /**
32 * @throws java.lang.Exception
33 * @see junit.framework.TestCase#tearDown()
34 */
35 @Override
36 protected void setUp() throws Exception {
37 super.setUp();
38 factory = new UnivariateRealSolverFactoryImpl();
39 }
40
41 /**
42 * @throws java.lang.Exception
43 * @see junit.framework.TestCase#tearDown()
44 */
45 @Override
46 protected void tearDown() throws Exception {
47 factory = null;
48 super.tearDown();
49 }
50
51 public void testNewBisectionSolverValid() {
52 UnivariateRealSolver solver = factory.newBisectionSolver();
53 assertNotNull(solver);
54 assertTrue(solver instanceof BisectionSolver);
55 }
56
57 public void testNewNewtonSolverValid() {
58 UnivariateRealSolver solver = factory.newNewtonSolver();
59 assertNotNull(solver);
60 assertTrue(solver instanceof NewtonSolver);
61 }
62
63 public void testNewBrentSolverValid() {
64 UnivariateRealSolver solver = factory.newBrentSolver();
65 assertNotNull(solver);
66 assertTrue(solver instanceof BrentSolver);
67 }
68
69 public void testNewSecantSolverValid() {
70 UnivariateRealSolver solver = factory.newSecantSolver();
71 assertNotNull(solver);
72 assertTrue(solver instanceof SecantSolver);
73 }
74
75 }