1 26 27 package net.sourceforge.groboutils.autodoc.v1.testserver.junit; 28 29 import net.sourceforge.groboutils.autodoc.v1.*; 30 import net.sourceforge.groboutils.autodoc.v1.testserver.*; 31 32 import org.easymock.EasyMock; 33 import org.easymock.MockControl; 34 import net.sourceforge.groboutils.junit.v1.iftc.*; 35 import junit.framework.Test; 36 import junit.framework.TestCase; 37 import junit.framework.TestSuite; 38 39 40 47 public class JUnitTestInfoJDK13UTest extends TestCase 48 { 49 52 private static final Class THIS_CLASS = JUnitTestInfoJDK13UTest.class; 53 54 public JUnitTestInfoJDK13UTest( String name ) 55 { 56 super( name ); 57 } 58 59 60 63 private MockControl logControl; 64 private AutoDocLog mockLog; 65 66 private MockControl itControl; 67 private AutoDocIT mockIT; 68 69 private MockControl tpControl; 70 private AutoDocTP mockTP; 71 72 73 77 protected void setUp() throws Exception 78 { 79 super.setUp(); 80 81 this.logControl = EasyMock.controlFor( AutoDocLog.class ); 83 this.mockLog = (AutoDocLog)this.logControl.getMock(); 84 85 this.itControl = EasyMock.controlFor( AutoDocIT.class ); 86 this.mockIT = (AutoDocIT)this.itControl.getMock(); 87 88 this.tpControl = EasyMock.controlFor( AutoDocTP.class ); 89 this.mockTP = (AutoDocTP)this.tpControl.getMock(); 90 } 91 92 93 96 97 public void testConstructor1() 98 { 99 try 100 { 101 new JUnitTestInfo( null ); 102 fail("Did not throw IllegalArgumentException."); 103 } 104 catch (IllegalArgumentException e) 105 { 106 } 108 } 109 110 111 public void testConstructor2() 112 { 113 JUnitTestInfo ti = new JUnitTestInfo( this ); 114 assertEquals( 115 "Did not set suite name correctly.", 116 getClass().getName(), 117 ti.getSuite() ); 118 assertEquals( 119 "Did not set method name correctly.", 120 getName(), 121 ti.getMethod() ); 122 } 123 124 125 public void testConstructor3() 126 { 127 String name = "myName"; 128 TestSuite ts = new TestSuite(); 129 ts.setName( name ); 130 JUnitTestInfo ti = new JUnitTestInfo( ts ); 131 assertEquals( 132 "Did not set suite name correctly.", 133 name, 134 ti.getSuite() ); 135 assertEquals( 136 "Did not set method name correctly.", 137 "run", 138 ti.getMethod() ); 139 } 140 141 142 143 146 147 148 151 152 public static Test suite() 153 { 154 InterfaceTestSuite suite = TestInfoUTestI.suite(); 155 suite.addTestSuite( THIS_CLASS ); 156 suite.addFactory( new CxFactory( "A" ) { 157 public Object createImplObject() { 158 return new JUnitTestInfo( new Object () ); 159 } 160 } ); 161 162 return suite; 163 } 164 165 public static void main( String [] args ) 166 { 167 String [] name = { THIS_CLASS.getName() }; 168 169 172 junit.textui.TestRunner.main( name ); 173 } 174 175 176 180 protected void tearDown() throws Exception 181 { 182 184 super.tearDown(); 185 } 186 } 187 188 | Popular Tags |