1 17 18 package org.apache.avalon.framework.test; 19 20 import org.apache.avalon.framework.CascadingException; 21 import org.apache.avalon.framework.CascadingThrowable; 22 23 import junit.framework.TestCase; 24 25 31 public class CascadingExceptionTestCase extends TestCase 32 { 33 public void testConstructor() 34 { 35 assertNotNull( new CascadingException( null, null ) ); 36 assertNotNull( new CascadingException( "msg", null ) ); 37 assertNotNull( 38 new CascadingException( "msg", new RuntimeException () ) ); 39 assertNotNull( new CascadingException( null, new RuntimeException () ) ); 40 41 assertNotNull( new CascadingException( "msg" ) ); 42 } 45 46 public void testGetCause() 47 { 48 RuntimeException re = new RuntimeException (); 49 CascadingException e = new CascadingException( "msg", re ); 50 51 assertEquals( re, e.getCause() ); 52 53 e = new CascadingException( "msg", null ); 54 assertNull( e.getCause() ); 55 56 74 } 75 76 public void testCasts() 77 { 78 CascadingException e = new CascadingException( "msg", null ); 79 assertTrue( e instanceof Exception ); 80 assertTrue( e instanceof CascadingThrowable ); 81 } 82 } 83 | Popular Tags |