01: /*
02: *
03: * Copyright (c) 2003-2004 The Apache Software Foundation. All rights reserved.
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
06: * use this file except in compliance with the License. You may obtain a copy
07: * of the License at
08: *
09: * 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,
56: cause);
57: assertEquals(outMsg, ex.getMessage());
58: assertEquals(cause, ex.getCause());
59: }
60:
61: /**
62: *
63: */
64: public void testConstructorCause() {
65: String inMsg = "inner message";
66: Exception cause = new Exception(inMsg);
67: ConvergenceException ex = new ConvergenceException(cause);
68: assertEquals(cause, ex.getCause());
69: }
70: }
|