1 26 27 package net.sourceforge.groboutils.mbtf.v1.engine; 28 29 import org.easymock.EasyMock; 30 import org.easymock.MockControl; 31 import junit.framework.Test; 32 import junit.framework.TestCase; 33 import junit.framework.TestSuite; 34 35 import net.sourceforge.groboutils.mbtf.v1.IPathHistory; 36 37 44 public class ErrorImplJDK13UTest extends TestCase 45 { 46 49 private static final Class THIS_CLASS = ErrorImplJDK13UTest.class; 50 51 public ErrorImplJDK13UTest( String name ) 52 { 53 super( name ); 54 } 55 56 57 60 private MockControl phControl; 61 private IPathHistory mockPH; 62 63 64 68 protected void setUp() throws Exception 69 { 70 super.setUp(); 71 72 this.phControl = EasyMock.controlFor( IPathHistory.class ); 74 this.mockPH = (IPathHistory)this.phControl.getMock(); 75 } 76 77 78 81 82 public void testConstructor1() 83 { 84 ErrorImpl ei = new ErrorImpl( null, null, null ); 85 86 assertNull( 87 "didn't set path history right.", 88 ei.getPathHistory() ); 89 assertNull( 90 "didn't set throwable right.", 91 ei.getThrowable() ); 92 assertNull( 93 "didn't set message right.", 94 ei.getMessage() ); 95 } 96 97 98 public void testConstructor2() 99 { 100 String msg = "blah"; 101 Throwable t = new Throwable (); 102 this.phControl.activate(); 103 104 ErrorImpl ei = new ErrorImpl( msg, t, this.mockPH ); 105 106 assertEquals( 107 "didn't set path history right.", 108 ei.getPathHistory(), 109 this.mockPH ); 110 assertEquals( 111 "didn't set throwable right.", 112 ei.getThrowable(), 113 t ); 114 assertEquals( 115 "didn't set message right.", 116 ei.getMessage(), 117 msg ); 118 } 119 120 121 124 125 128 129 public static Test suite() 130 { 131 TestSuite suite = new TestSuite( THIS_CLASS ); 132 133 144 return suite; 145 } 146 147 public static void main( String [] args ) 148 { 149 String [] name = { THIS_CLASS.getName() }; 150 151 154 junit.textui.TestRunner.main( name ); 155 } 156 157 158 162 protected void tearDown() throws Exception 163 { 164 166 super.tearDown(); 167 } 168 } 169 170 | Popular Tags |