1 17 18 24 package javax.jms; 25 26 import junit.framework.TestCase; 27 28 29 32 public class JMSExceptionTest extends TestCase { 33 public void testConstructorNull() { 34 JMSException ex = new JMSException(null); 35 assertNull(ex.getMessage()); 36 assertNull(ex.getErrorCode()); 37 assertNull(ex.getLinkedException()); 38 } 39 40 public void testConstructorNullNull() { 41 JMSException ex = new JMSException(null, null); 42 assertNull(ex.getMessage()); 43 assertNull(ex.getErrorCode()); 44 assertNull(ex.getLinkedException()); 45 } 46 47 public void testConstructorNullString() { 48 String expected = "some code"; 49 JMSException ex = new JMSException(null, expected); 50 assertNull(ex.getMessage()); 51 assertEquals(expected, ex.getErrorCode()); 52 assertNull(ex.getLinkedException()); 53 } 54 55 public void testConstructorString() { 56 String expected = "some message"; 57 JMSException ex = new JMSException(expected); 58 assertEquals(expected, ex.getMessage()); 59 assertNull(ex.getErrorCode()); 60 assertNull(ex.getLinkedException()); 61 } 62 63 public void testConstructorStringNull() { 64 String expected = "some message"; 65 JMSException ex = new JMSException(expected, null); 66 assertEquals(expected, ex.getMessage()); 67 assertNull(ex.getErrorCode()); 68 assertNull(ex.getLinkedException()); 69 } 70 71 public void testConstructorStringString() { 72 String expectedMessage = "some message"; 73 String expectedCode = "some code"; 74 JMSException ex = new JMSException(expectedMessage, expectedCode); 75 assertEquals(expectedMessage, ex.getMessage()); 76 assertEquals(expectedCode, ex.getErrorCode()); 77 assertNull(ex.getLinkedException()); 78 } 79 80 public void testSetLinkedException() { 81 Exception expected = new Exception(); 82 JMSException ex = new JMSException(null); 83 ex.setLinkedException(expected); 84 assertEquals(expected, ex.getLinkedException()); 85 } 86 } 87 | Popular Tags |