1 26 27 package net.sourceforge.groboutils.codecoverage.v2.logger; 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 CoverageLoggerUTest extends TestCase 43 { 44 47 private static final Class THIS_CLASS = CoverageLoggerUTest.class; 48 private static final AutoDoc DOC = new AutoDoc( THIS_CLASS ); 49 50 public CoverageLoggerUTest( String name ) 51 { 52 super( name ); 53 } 54 55 56 59 60 public void testDescription1() 61 { 62 DOC.getLog().warn( 63 "The CoverageLogger class is very difficult to test if we "+ 64 "assume that the class is being code covered, as it creates a "+ 65 "chicken-and-the-egg scenario. If we allow ourselves to test "+ 66 "this class, then we must temporarily corrupt the state of the "+ 67 "testing." ); 68 DOC.getLog().warn( 69 "One way to test is through reflection by loading another "+ 70 "instance of the class. This would use difficult (and fragile) "+ 71 "manipulation of the class and its static state. Another would "+ 72 "be to only run this unit test without code coverage running." ); 73 DOC.getLog().warn( 74 "Perhaps the correct solution is to rearchitect the class such "+ 75 "that it is easier to test." ); 76 } 77 78 79 80 83 84 85 88 89 public static Test suite() 90 { 91 TestSuite suite = new TestSuite( THIS_CLASS ); 92 93 return suite; 94 } 95 96 public static void main( String [] args ) 97 { 98 String [] name = { THIS_CLASS.getName() }; 99 100 103 junit.textui.TestRunner.main( name ); 104 } 105 106 107 111 protected void setUp() throws Exception 112 { 113 super.setUp(); 114 115 116 } 118 119 120 124 protected void tearDown() throws Exception 125 { 126 128 129 super.tearDown(); 130 } 131 } 132 133 | Popular Tags |