1 26 27 package net.sourceforge.groboutils.codecoverage.v2.datastore; 28 29 import java.io.File ; 30 import java.io.IOException ; 31 32 import junit.framework.Test; 33 import junit.framework.TestCase; 34 import junit.framework.TestSuite; 35 import net.sourceforge.groboutils.autodoc.v1.AutoDoc; 36 import net.sourceforge.groboutils.codecoverage.v2.CCCreatorUtil; 37 import net.sourceforge.groboutils.codecoverage.v2.IAnalysisModule; 38 39 40 47 public class DirMetaDataIOUTest extends TestCase 48 { 49 52 private static final Class THIS_CLASS = DirMetaDataIOUTest.class; 53 private static final AutoDoc DOC = new AutoDoc( THIS_CLASS ); 54 55 public DirMetaDataIOUTest( String name ) 56 { 57 super( name ); 58 } 59 60 61 64 65 public void testConstructor1() 66 { 67 } 69 70 71 public void testGetAnalysisModuleSet1() throws IOException 72 { 73 File f = CCCreatorUtil.createNewDirectory(); 75 DirMetaDataIO dmd = new DirMetaDataIO( f ); 76 AnalysisModuleSet ams = dmd.getAnalysisModuleSet(); 77 assertEquals( 78 "Somehow we created data from nothing.", 79 0, 80 ams.getAnalysisModuleCount() ); 81 } 82 83 84 public void testPutAnalysisModuleSet1() throws IOException 85 { 86 File f = CCCreatorUtil.createNewDirectory(); 88 AnalysisModuleSet ams = CCCreatorUtil.createAnalysisModuleSet( 4 ); 89 DirMetaDataIO dmd = new DirMetaDataIO( f ); 90 dmd.getAnalysisModuleSet(); 91 dmd.putAnalysisModuleSet( ams ); 92 AnalysisModuleSet ams2 = dmd.getAnalysisModuleSet(); 93 assertEquals( 94 "Didn't recreate the four modules.", 95 4, 96 ams2.getAnalysisModuleCount() ); 97 } 98 99 100 public void testPutAnalysisModuleSet2() throws IOException 101 { 102 File f = CCCreatorUtil.createNewDirectory(); 104 IAnalysisModule am = CCCreatorUtil.createIAnalysisModule( "a", "u", 105 "text/plain" ); 106 DirMetaDataIO dmd = new DirMetaDataIO( f ); 107 dmd.getAnalysisModuleSet(); 108 dmd.putAnalysisModuleSet( new AnalysisModuleSet( 109 new IAnalysisModule[] { am } ) ); 110 AnalysisModuleSet ams = dmd.getAnalysisModuleSet(); 111 assertEquals( 112 "Didn't recreate the one module.", 113 1, 114 ams.getAnalysisModuleCount() ); 115 assertTrue( 116 "Bad module index.", 117 ams.getAnalysisModuleIndex( am ) >= 0 ); 118 assertTrue( 119 "Bad measure index.", 120 ams.getMeasureIndex( "a" ) >= 0 ); 121 } 122 123 124 125 126 127 130 131 132 135 136 public static Test suite() 137 { 138 TestSuite suite = new TestSuite( THIS_CLASS ); 139 140 return suite; 141 } 142 143 public static void main( String [] args ) 144 { 145 String [] name = { THIS_CLASS.getName() }; 146 147 150 junit.textui.TestRunner.main( name ); 151 } 152 153 154 158 protected void setUp() throws Exception 159 { 160 super.setUp(); 161 162 163 } 165 166 167 171 protected void tearDown() throws Exception 172 { 173 175 176 super.tearDown(); 177 } 178 } 179 180 | Popular Tags |