KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > jms > IllegalStateExceptionTest


1 /**
2  *
3  * Copyright 2003-2004 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy 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,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 //
19
// This source code implements specifications defined by the Java
20
// Community Process. In order to remain compliant with the specification
21
// DO NOT add / change / or delete method signatures!
22
//
23

24 package javax.jms;
25
26 import junit.framework.TestCase;
27
28
29 /**
30  *
31  * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
32  */

33 public class IllegalStateExceptionTest extends TestCase {
34     public void testConstructorNull() {
35         IllegalStateException ex = new IllegalStateException(null);
36         assertNull(ex.getMessage());
37         assertNull(ex.getErrorCode());
38         assertNull(ex.getLinkedException());
39     }
40
41     public void testConstructorNullNull() {
42         IllegalStateException ex = new IllegalStateException(null, null);
43         assertNull(ex.getMessage());
44         assertNull(ex.getErrorCode());
45         assertNull(ex.getLinkedException());
46     }
47
48     public void testConstructorNullString() {
49         String expected = "some code";
50         IllegalStateException ex = new IllegalStateException(null, expected);
51         assertNull(ex.getMessage());
52         assertEquals(expected, ex.getErrorCode());
53         assertNull(ex.getLinkedException());
54     }
55
56     public void testConstructorString() {
57         String expected = "some message";
58         IllegalStateException ex = new IllegalStateException(expected);
59         assertEquals(expected, ex.getMessage());
60         assertNull(ex.getErrorCode());
61         assertNull(ex.getLinkedException());
62     }
63
64     public void testConstructorStringNull() {
65         String expected = "some message";
66         IllegalStateException ex = new IllegalStateException(expected, null);
67         assertEquals(expected, ex.getMessage());
68         assertNull(ex.getErrorCode());
69         assertNull(ex.getLinkedException());
70     }
71
72     public void testConstructorStringString() {
73         String expectedMessage = "some message";
74         String expectedCode = "some code";
75         IllegalStateException ex = new IllegalStateException(expectedMessage, expectedCode);
76         assertEquals(expectedMessage, ex.getMessage());
77         assertEquals(expectedCode, ex.getErrorCode());
78         assertNull(ex.getLinkedException());
79     }
80 }
81
82
Popular Tags