1   /*
2    * 
3    * Copyright (c) 2003-2004 The Apache Software Foundation. All rights reserved.
4    * 
5    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6    * use this file except in compliance with the License. You may obtain a copy
7    * of the License at
8    * 
9    * http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14   * License for the specific language governing permissions and limitations
15   * under the License.
16   *  
17   */
18  
19  package org.apache.commons.math.analysis;
20  
21  import org.apache.commons.math.ConvergenceException;
22  
23  import junit.framework.TestCase;
24  
25  /**
26   * @version $Revision: 155427 $ $Date: 2005-02-26 06:11:52 -0700 (Sat, 26 Feb 2005) $
27   */
28  public class ConvergenceExceptionTest extends TestCase {
29      /**
30       * 
31       */
32      public void testConstructor(){
33          ConvergenceException ex = new ConvergenceException();
34          assertNull(ex.getCause());
35          assertNull(ex.getMessage());
36      }
37      
38      /**
39       * 
40       */
41      public void testConstructorMessage(){
42          String msg = "message";
43          ConvergenceException ex = new ConvergenceException(msg);
44          assertNull(ex.getCause());
45          assertEquals(msg, ex.getMessage());
46      }
47      
48      /**
49       * 
50       */
51      public void testConstructorMessageCause(){
52          String outMsg = "outer message";
53          String inMsg = "inner message";
54          Exception cause = new Exception(inMsg);
55          ConvergenceException ex = new ConvergenceException(outMsg, cause);
56          assertEquals(outMsg, ex.getMessage());
57          assertEquals(cause, ex.getCause());
58      }
59      
60      /**
61       * 
62       */
63      public void testConstructorCause(){
64          String inMsg = "inner message";
65          Exception cause = new Exception(inMsg);
66          ConvergenceException ex = new ConvergenceException(cause);
67          assertEquals(cause, ex.getCause());
68      }
69  }