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 31 public class NullArgumentExceptionTest extends TestCase { 32 33 public static void main(String [] args) { 34 TestRunner.run(suite()); 35 } 36 37 public static Test suite() { 38 return new TestSuite(NullArgumentExceptionTest.class); 39 } 40 41 public NullArgumentExceptionTest(String testName) { 42 super(testName); 43 } 44 45 47 public void testConstructor_nullInput() { 48 new NullArgumentException(null); 49 } 50 51 53 public void testGetMessage_nullConstructorInput() { 54 final Throwable t = new NullArgumentException(null); 55 assertEquals("Argument must not be null.", t.getMessage()); 56 } 57 58 public void testGetMessage_validConstructorInput() { 59 final String argName = "name"; 60 final Throwable t = new NullArgumentException(argName); 61 assertEquals(argName + " must not be null.", t.getMessage()); 62 } 63 64 } 66 | Popular Tags |