1 26 27 package net.sourceforge.groboutils.codecoverage.v2.report; 28 29 import junit.framework.Test; 30 import junit.framework.TestCase; 31 import net.sourceforge.groboutils.autodoc.v1.AutoDoc; 32 import net.sourceforge.groboutils.junit.v1.iftc.CxFactory; 33 import net.sourceforge.groboutils.junit.v1.iftc.InterfaceTestSuite; 34 35 36 43 public class XmlReportGeneratorUTest extends TestCase 44 { 45 48 private static final Class THIS_CLASS = XmlReportGeneratorUTest.class; 49 private static final AutoDoc DOC = new AutoDoc( THIS_CLASS ); 50 51 public XmlReportGeneratorUTest( String name ) 52 { 53 super( name ); 54 } 55 56 57 60 61 public void testConstructor1() 62 { 63 new XmlReportGenerator(); 64 } 65 66 67 public void testTranslate1() 68 { 69 assertEquals( 70 "Does not translate null.", 71 null, 72 XmlReportGenerator.translate( null ) ); 73 } 74 75 76 public void testTranslate2() 77 { 78 assertEquals( 79 "Does not translate empty string.", 80 "", 81 XmlReportGenerator.translate( "" ) ); 82 } 83 84 85 public void testTranslate3() 86 { 87 assertEquals( 88 "Does not translate no parms.", 89 "x", 90 XmlReportGenerator.translate( "x" ) ); 91 } 92 93 94 public void testTranslate4() 95 { 96 assertEquals( 97 "Does not translate bad parms.", 98 "x(", 99 XmlReportGenerator.translate( "x(" ) ); 100 } 101 102 103 public void testTranslate5() 104 { 105 assertEquals( 106 "Does not translate only parms.", 107 "(boolean)", 108 XmlReportGenerator.translate( "(Z)" ) ); 109 } 110 111 112 public void testTranslate6() 113 { 114 assertEquals( 115 "Does not translate empty parms.", 116 "x()", 117 XmlReportGenerator.translate( "x()" ) ); 118 } 119 120 121 public void testTranslate7() 122 { 123 assertEquals( 124 "Does not translate object.", 125 "x(me.my.Oh)", 126 XmlReportGenerator.translate( "x(Lme/my/Oh;)" ) ); 127 } 128 129 130 public void testTranslate8() 131 { 132 assertEquals( 133 "Does not translate object.", 134 "x(me.my.Oh, boolean)", 135 XmlReportGenerator.translate( "x(Lme/my/Oh;Z)" ) ); 136 } 137 138 139 public void testTranslate9() 140 { 141 assertEquals( 142 "Does not strip return.", 143 "x()", 144 XmlReportGenerator.translate( "x()V" ) ); 145 } 146 147 148 public void testTranslate10() 149 { 150 assertEquals( 151 "Does not strip return.", 152 "x(boolean)", 153 XmlReportGenerator.translate( "x(Z)V" ) ); 154 } 155 156 157 public void testTranslate11() 158 { 159 assertEquals( 160 "Does not keep <init> as is.", 161 "<init>", 162 XmlReportGenerator.translate( "<init>" ) ); 163 } 164 165 166 public void testTranslate12() 167 { 168 assertEquals( 169 "Does not keep <init>( as is.", 170 "<init>(", 171 XmlReportGenerator.translate( "<init>(" ) ); 172 } 173 174 175 public void testTranslate13() 176 { 177 assertEquals( 178 "Does not translate <init>() right.", 179 "[constructor]()", 180 XmlReportGenerator.translate( "<init>()" ) ); 181 } 182 183 184 public void testTranslate14() 185 { 186 assertEquals( 187 "Does not translate <init>(ZZ) right.", 188 "[constructor](boolean, boolean)", 189 XmlReportGenerator.translate( "<init>(ZZ)" ) ); 190 } 191 192 193 public void testTranslate15() 194 { 195 assertEquals( 196 "Does not keep <clinit> as is.", 197 "<clinit>", 198 XmlReportGenerator.translate( "<clinit>" ) ); 199 } 200 201 202 public void testTranslate16() 203 { 204 assertEquals( 205 "Does not keep <clinit>( as is.", 206 "<clinit>(", 207 XmlReportGenerator.translate( "<clinit>(" ) ); 208 } 209 210 211 public void testTranslate17() 212 { 213 assertEquals( 214 "Does not translate <clinit>() right.", 215 "[static initializer]", 216 XmlReportGenerator.translate( "<clinit>()" ) ); 217 } 218 219 220 public void testTranslate18() 221 { 222 assertEquals( 223 "Does not translate <clinit>(Z) right.", 224 "[static initializer]", 225 XmlReportGenerator.translate( "<clinit>(Z)" ) ); 226 } 227 228 229 230 233 234 235 238 239 public static Test suite() 240 { 241 InterfaceTestSuite suite = IReportGeneratorUTestI.suite(); 242 suite.addTestSuite( THIS_CLASS ); 243 suite.addFactory( new CxFactory( "A" ) { 244 public Object createImplObject() { 245 return new XmlReportGenerator(); 246 } 247 } ); 248 249 return suite; 250 } 251 252 public static void main( String [] args ) 253 { 254 String [] name = { THIS_CLASS.getName() }; 255 256 259 junit.textui.TestRunner.main( name ); 260 } 261 262 263 267 protected void setUp() throws Exception 268 { 269 super.setUp(); 270 271 272 } 274 275 276 280 protected void tearDown() throws Exception 281 { 282 284 285 super.tearDown(); 286 } 287 } 288 289 | Popular Tags |