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