1 26 27 package net.sourceforge.groboutils.codecoverage.v2.ant; 28 29 import java.io.File ; 30 import java.io.IOException ; 31 import java.util.Properties ; 32 33 import junit.framework.Test; 34 import junit.framework.TestSuite; 35 import net.sourceforge.groboutils.autodoc.v1.AutoDoc; 36 37 38 45 public class GroboReportTaskUTest extends AntTestA 46 { 47 50 private static final Class THIS_CLASS = GroboReportTaskUTest.class; 51 private static final AutoDoc DOC = new AutoDoc( THIS_CLASS ); 52 53 public GroboReportTaskUTest( String name ) 54 { 55 super( name ); 56 } 57 58 59 62 65 public void testReport1() 66 { 67 executeTarget( "report-1" ); 68 } 69 70 public void testReport2() 71 { 72 executeTarget( "report-2" ); 73 } 74 75 public void testReport3() 76 { 77 try 78 { 79 executeTarget( "report-3" ); 80 } 81 finally 82 { 83 System.out.println( getFullLog() ); 84 } 85 } 86 87 public void testReport4() 88 { 89 executeTarget( "report-4" ); 90 } 91 92 93 96 97 public void testFReport1() 98 { 99 expectBuildExceptionContaining( "f-report-1", 100 "Did not fail for no destdir attribute.", 101 "Must set the 'destdir' attribute." ); 102 } 103 104 105 108 109 protected void assertEquals( String text, Properties expected, 110 Properties actual ) 111 { 112 PropertyCheckUtil.assertEquals( text, expected, actual ); 113 } 114 115 116 protected Properties loadGroboProperties() 117 throws IOException 118 { 119 return loadProperties( 120 (new File ( getCoverageDir(), 121 "classes" + File.separator + "grobocoverage.properties")). 122 getAbsolutePath() ); 123 } 124 125 126 protected Properties loadProperties( String file ) 127 throws IOException 128 { 129 return PropertyCheckUtil.loadProperties( file ); 130 } 131 132 133 protected File getCoverageDir() 134 { 135 return new File ( getProjectDir(), "instrument" + 136 File.separator + "coverage" ); 137 } 138 139 140 143 144 public static Test suite() 145 { 146 TestSuite suite = new TestSuite( THIS_CLASS ); 147 148 return suite; 149 } 150 151 public static void main( String [] args ) 152 { 153 String [] name = { THIS_CLASS.getName() }; 154 155 158 junit.textui.TestRunner.main( name ); 159 } 160 161 162 166 protected void setUp() throws Exception 167 { 168 super.setUp(); 169 170 configureProject( "report.xml" ); 172 } 173 174 175 179 protected void tearDown() throws Exception 180 { 181 executeTarget( "test-teardown" ); 183 184 super.tearDown(); 185 } 186 } 187 188 | Popular Tags |