1 16 package org.apache.commons.lang; 17 18 import junit.framework.Test; 19 import junit.framework.TestCase; 20 import junit.framework.TestSuite; 21 import junit.textui.TestRunner; 22 23 30 public class NotImplementedExceptionTest extends TestCase { 31 32 public static void main(String [] args) { 33 TestRunner.run(suite()); 34 } 35 36 public static Test suite() { 37 return new TestSuite(NotImplementedExceptionTest.class); 38 } 39 40 public NotImplementedExceptionTest(String testName) { 41 super(testName); 42 } 43 44 public void testConstructor_() { 46 NotImplementedException ex = new NotImplementedException(); 47 assertEquals("Code is not implemented", ex.getMessage()); 48 assertEquals(null, ex.getCause()); 49 } 50 51 public void testConstructor_String1() { 52 NotImplementedException ex = new NotImplementedException((String ) null); 53 assertEquals("Code is not implemented", ex.getMessage()); 54 assertEquals(null, ex.getCause()); 55 } 56 public void testConstructor_String2() { 57 NotImplementedException ex = new NotImplementedException("msg"); 58 assertEquals("msg", ex.getMessage()); 59 assertEquals(null, ex.getCause()); 60 } 61 62 public void testConstructor_Throwable1() { 63 NotImplementedException ex = new NotImplementedException((Throwable ) null); 64 assertEquals("Code is not implemented", ex.getMessage()); 65 assertEquals(null, ex.getCause()); 66 } 67 public void testConstructor_Throwable2() { 68 Exception npe = new NullPointerException (); 69 NotImplementedException ex = new NotImplementedException(npe); 70 assertEquals("Code is not implemented", ex.getMessage()); 71 assertSame(npe, ex.getCause()); 72 } 73 74 public void testConstructor_StringThrowable1() { 75 NotImplementedException ex = new NotImplementedException((String ) null, (Throwable ) null); 76 assertEquals("Code is not implemented", ex.getMessage()); 77 assertEquals(null, ex.getCause()); 78 } 79 public void testConstructor_StringThrowable2() { 80 Exception npe = new NullPointerException (); 81 NotImplementedException ex = new NotImplementedException("msg", npe); 82 assertEquals("msg", ex.getMessage()); 83 assertSame(npe, ex.getCause()); 84 } 85 86 public void testConstructor_Class1() { 87 NotImplementedException ex = new NotImplementedException((Class ) null); 88 assertEquals("Code is not implemented", ex.getMessage()); 89 assertEquals(null, ex.getCause()); 90 } 91 public void testConstructor_Class2() { 92 NotImplementedException ex = new NotImplementedException(String .class); 93 assertEquals("Code is not implemented in class java.lang.String", ex.getMessage()); 94 assertEquals(null, ex.getCause()); 95 } 96 97 } 98 | Popular Tags |