1 26 27 package net.sourceforge.groboutils.autodoc.v1.defimpl; 28 29 import net.sourceforge.groboutils.autodoc.v1.spi.AutoDocLogFactory; 30 import net.sourceforge.groboutils.autodoc.v1.*; 31 import net.sourceforge.groboutils.autodoc.v1.spi.*; 32 33 import org.easymock.EasyMock; 34 import org.easymock.MockControl; 35 import net.sourceforge.groboutils.junit.v1.iftc.*; 36 import junit.framework.Test; 37 import junit.framework.TestCase; 38 import junit.framework.TestSuite; 39 40 import java.util.*; 41 42 43 50 public class AutoDocITSetUTest extends TestCase 51 { 52 55 private static final Class THIS_CLASS = AutoDocITSetUTest.class; 56 57 public AutoDocITSetUTest( String name ) 58 { 59 super( name ); 60 } 61 62 63 66 70 protected void setUp() throws Exception 71 { 72 super.setUp(); 73 74 } 76 77 78 81 82 private static class MyAutoDocIT implements AutoDocIT 83 { 84 public Vector methodNames = new Vector(); 85 public Vector longIssueID = new Vector(); 86 public Vector strIssueID = new Vector(); 87 88 public void testsIssue( String methodName, long issueID ) 89 { 90 this.methodNames.addElement( methodName ); 91 this.longIssueID.addElement( new Long ( issueID ) ); 92 } 93 94 95 public void testsIssue( String methodName, String issueID ) 96 { 97 this.methodNames.addElement( methodName ); 98 this.strIssueID.addElement( issueID ); 99 } 100 101 102 public void testsIssue( long issueID ) 103 { 104 this.longIssueID.addElement( new Long ( issueID ) ); 105 } 106 107 108 public void testsIssue( String issueID ) 109 { 110 this.strIssueID.addElement( issueID ); 111 } 112 } 113 114 115 public void testTestsIssue1() 116 { 117 MyAutoDocIT mad = new MyAutoDocIT(); 118 AutoDocITSet set = new AutoDocITSet(); 119 set.addIT( mad ); 120 121 set.testsIssue( "name", 1L ); 122 123 assertEquals( 124 "Did not add only 1 method name.", 125 mad.methodNames.size(), 126 1 ); 127 assertEquals( 128 "Did not add only 1 long id.", 129 mad.longIssueID.size(), 130 1 ); 131 assertEquals( 132 "Added a string id.", 133 mad.strIssueID.size(), 134 0 ); 135 } 136 137 138 public void testTestsIssue2() 139 { 140 MyAutoDocIT mad = new MyAutoDocIT(); 141 AutoDocITSet set = new AutoDocITSet(); 142 set.addIT( mad ); 143 144 set.testsIssue( "name", "1" ); 145 146 assertEquals( 147 "Did not add only 1 method name.", 148 mad.methodNames.size(), 149 1 ); 150 assertEquals( 151 "Did not add only 1 string id.", 152 mad.strIssueID.size(), 153 1 ); 154 assertEquals( 155 "Added a long id.", 156 mad.longIssueID.size(), 157 0 ); 158 } 159 160 161 public void testTestsIssue3() 162 { 163 MyAutoDocIT mad = new MyAutoDocIT(); 164 AutoDocITSet set = new AutoDocITSet(); 165 set.addIT( mad ); 166 167 set.testsIssue( 1L ); 168 169 assertEquals( 170 "Added a method name.", 171 mad.methodNames.size(), 172 0 ); 173 assertEquals( 174 "Did not add only 1 long id.", 175 mad.longIssueID.size(), 176 1 ); 177 assertEquals( 178 "Added a string id.", 179 mad.strIssueID.size(), 180 0 ); 181 } 182 183 184 public void testTestsIssue4() 185 { 186 MyAutoDocIT mad = new MyAutoDocIT(); 187 AutoDocITSet set = new AutoDocITSet(); 188 set.addIT( mad ); 189 190 set.testsIssue( "l" ); 191 192 assertEquals( 193 "Added a method name.", 194 mad.methodNames.size(), 195 0 ); 196 assertEquals( 197 "Did not add only 1 string id.", 198 mad.strIssueID.size(), 199 1 ); 200 assertEquals( 201 "Added a long id.", 202 mad.longIssueID.size(), 203 0 ); 204 } 205 206 207 210 211 public static Test suite() 212 { 213 TestSuite suite = new TestSuite( THIS_CLASS ); 214 InterfaceTestSuite its = AutoDocITUTestI.suite(); 215 its.addInterfaceTestSuite( IAutoDocSetUTestI.suite() ); 216 its.addFactory( new CxFactory( "A" ) { 217 public Object createImplObject() { 218 return new AutoDocITSet(); 219 } 220 } ); 221 suite.addTest( its ); 222 223 return suite; 224 } 225 226 public static void main( String [] args ) 227 { 228 String [] name = { THIS_CLASS.getName() }; 229 230 233 junit.textui.TestRunner.main( name ); 234 } 235 236 237 241 protected void tearDown() throws Exception 242 { 243 245 super.tearDown(); 246 } 247 } 248 249 | Popular Tags |