1 17 18 24 package javax.jms; 25 26 import junit.framework.TestCase; 27 28 29 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 |