001 /*
002 *
003 * Licensed to the Apache Software Foundation (ASF) under one or more
004 * contributor license agreements. See the NOTICE file distributed with
005 * this work for additional information regarding copyright ownership.
006 * The ASF licenses this file to You under the Apache License, Version 2.0
007 * (the "License"); you may not use this file except in compliance with
008 * the License. You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019 package org.apache.commons.math.analysis.solvers;
020
021 import junit.framework.TestCase;
022
023 /**
024 * @version $Revision: 799857 $ $Date: 2009-08-01 09:07:12 -0400 (Sat, 01 Aug 2009) $
025 */
026 public class UnivariateRealSolverFactoryImplTest extends TestCase {
027
028 /** solver factory */
029 private UnivariateRealSolverFactory factory;
030
031 /**
032 * @throws java.lang.Exception
033 * @see junit.framework.TestCase#tearDown()
034 */
035 @Override
036 protected void setUp() throws Exception {
037 super.setUp();
038 factory = new UnivariateRealSolverFactoryImpl();
039 }
040
041 /**
042 * @throws java.lang.Exception
043 * @see junit.framework.TestCase#tearDown()
044 */
045 @Override
046 protected void tearDown() throws Exception {
047 factory = null;
048 super.tearDown();
049 }
050
051 public void testNewBisectionSolverValid() {
052 UnivariateRealSolver solver = factory.newBisectionSolver();
053 assertNotNull(solver);
054 assertTrue(solver instanceof BisectionSolver);
055 }
056
057 public void testNewNewtonSolverValid() {
058 UnivariateRealSolver solver = factory.newNewtonSolver();
059 assertNotNull(solver);
060 assertTrue(solver instanceof NewtonSolver);
061 }
062
063 public void testNewBrentSolverValid() {
064 UnivariateRealSolver solver = factory.newBrentSolver();
065 assertNotNull(solver);
066 assertTrue(solver instanceof BrentSolver);
067 }
068
069 public void testNewSecantSolverValid() {
070 UnivariateRealSolver solver = factory.newSecantSolver();
071 assertNotNull(solver);
072 assertTrue(solver instanceof SecantSolver);
073 }
074
075 }