1 26 27 package net.sourceforge.groboutils.codecoverage.v2.report; 28 29 import junit.framework.Test; 30 import junit.framework.TestCase; 31 import junit.framework.TestSuite; 32 import net.sourceforge.groboutils.autodoc.v1.AutoDoc; 33 34 35 42 public class PackageSorterUTest extends TestCase 43 { 44 47 private static final Class THIS_CLASS = PackageSorterUTest.class; 48 private static final AutoDoc DOC = new AutoDoc( THIS_CLASS ); 49 50 public PackageSorterUTest( String name ) 51 { 52 super( name ); 53 } 54 55 56 59 public void testConstructor1() 60 { 61 new PackageSorter(); 62 } 63 64 65 public void testAddClassSignatures1() 66 { 67 PackageSorter ps = new PackageSorter(); 68 try 69 { 70 ps.addClassSignatures( null ); 71 fail( "Didn't throw IllegalArgumentException." ); 72 } 73 catch (IllegalArgumentException ex) 74 { 75 } 76 } 77 78 79 public void testAddClassSignatures2() 80 { 81 PackageSorter ps = new PackageSorter(); 82 try 83 { 84 ps.addClassSignatures( new String [2] ); 85 fail( "Didn't throw IllegalArgumentException." ); 86 } 87 catch (IllegalArgumentException ex) 88 { 89 } 90 } 91 92 93 public void testAddClassSignature1() 94 { 95 PackageSorter ps = new PackageSorter(); 96 try 97 { 98 ps.addClassSignature( null ); 99 fail( "Didn't throw IllegalArgumentException." ); 100 } 101 catch (IllegalArgumentException ex) 102 { 103 } 104 } 105 106 107 public void testAddClassSignature2() 108 { 109 PackageSorter ps = new PackageSorter(); 110 ps.addClassSignature( "a.b" ); 111 } 112 113 114 public void testAddClassSignature3() 115 { 116 PackageSorter ps = new PackageSorter(); 117 ps.addClassSignature( "a" ); 118 } 119 120 121 public void testAddClassSignature4() 122 { 123 PackageSorter ps = new PackageSorter(); 124 ps.addClassSignature( "" ); 125 } 126 127 128 public void testAddClassSignature5() 129 { 130 PackageSorter ps = new PackageSorter(); 131 ps.addClassSignature( "." ); 132 } 133 134 135 public void testGetPackages1() 136 { 137 PackageSorter ps = new PackageSorter(); 138 String s[] = ps.getPackages(); 139 assertNotNull( 140 "Got null package list.", 141 s ); 142 assertEquals( 143 "Created packages out of nothing.", 144 0, 145 s.length ); 146 } 147 148 149 public void testClassSignaturesForPackage1() 150 { 151 PackageSorter ps = new PackageSorter(); 152 String s[] = ps.getClassSignaturesForPackage( null ); 153 assertNotNull( 154 "Got null package list.", 155 s ); 156 assertEquals( 157 "Created packages out of nothing.", 158 0, 159 s.length ); 160 } 161 162 163 public void testClassSignaturesForPackage2() 164 { 165 PackageSorter ps = new PackageSorter(); 166 String s[] = ps.getClassSignaturesForPackage( "" ); 167 assertNotNull( 168 "Got null package list.", 169 s ); 170 assertEquals( 171 "Created packages out of nothing.", 172 0, 173 s.length ); 174 } 175 176 177 public void testGetPackageName1() 178 { 179 assertEquals( 180 "a", 181 PackageSorter.getPackageName( "a.b" ) ); 182 } 183 184 185 public void testGetPackageName2() 186 { 187 assertEquals( 188 "", 189 PackageSorter.getPackageName( ".b" ) ); 190 } 191 192 193 public void testGetPackageName3() 194 { 195 assertEquals( 196 "", 197 PackageSorter.getPackageName( "b" ) ); 198 } 199 200 201 public void testGetPackageName4() 202 { 203 assertEquals( 204 "", 205 PackageSorter.getPackageName( "." ) ); 206 } 207 208 209 public void testGetPackageName5() 210 { 211 assertEquals( 212 "a.b.c.d", 213 PackageSorter.getPackageName( "a.b.c.d.e" ) ); 214 } 215 216 217 public void testGetPackageName6() 218 { 219 assertEquals( 220 "a.b.c.d.e", 221 PackageSorter.getPackageName( "a.b.c.d.e." ) ); 222 } 223 224 225 228 229 230 233 234 public static Test suite() 235 { 236 TestSuite suite = new TestSuite( THIS_CLASS ); 237 238 return suite; 239 } 240 241 public static void main( String [] args ) 242 { 243 String [] name = { THIS_CLASS.getName() }; 244 245 248 junit.textui.TestRunner.main( name ); 249 } 250 251 252 256 protected void setUp() throws Exception 257 { 258 super.setUp(); 259 260 261 } 263 264 265 269 protected void tearDown() throws Exception 270 { 271 273 274 super.tearDown(); 275 } 276 } 277 278 | Popular Tags |