1 26 27 package net.sourceforge.groboutils.codecoverage.v2.datastore; 28 29 import java.io.IOException ; 30 31 import net.sourceforge.groboutils.autodoc.v1.AutoDoc; 32 import net.sourceforge.groboutils.codecoverage.v2.CCCreatorUtil; 33 import net.sourceforge.groboutils.codecoverage.v2.compiler.ModifiedClass; 34 import net.sourceforge.groboutils.junit.v1.iftc.ImplFactory; 35 import net.sourceforge.groboutils.junit.v1.iftc.InterfaceTestCase; 36 import net.sourceforge.groboutils.junit.v1.iftc.InterfaceTestSuite; 37 38 39 46 public class IClassMetaDataWriterUTestI extends InterfaceTestCase 47 { 48 51 private static final Class THIS_CLASS = IClassMetaDataWriterUTestI.class; 52 private static final AutoDoc DOC = new AutoDoc( THIS_CLASS ); 53 54 public IClassMetaDataWriterUTestI( String name, ImplFactory f ) 55 { 56 super( name, IClassMetaDataWriter.class, f ); 57 } 58 59 60 public IClassMetaDataWriter createIClassMetaDataWriter() 61 { 62 return (IClassMetaDataWriter)createImplObject(); 63 } 64 65 66 public final static AnalysisModuleSet AMS = 70 CCCreatorUtil.createAnalysisModuleSet( 2 ); 71 72 73 76 public void testWriteClassRecord1() throws Exception 77 { 78 IClassMetaDataWriter cmdw = createIClassMetaDataWriter(); 79 try 80 { 81 cmdw.writeClassRecord( null ); 82 fail( "Did not throw IllegalArgumentException." ); 83 } 84 catch (IllegalArgumentException ex) 85 { 86 } 88 } 89 90 91 public void testWriteClassRecord2() throws Exception 92 { 93 IClassMetaDataWriter cmdw = createIClassMetaDataWriter(); 94 ModifiedClass mc = CCCreatorUtil.createModifiedClass( THIS_CLASS ); 95 ClassRecord cr = mc.createClassRecord( AMS ); 96 97 cmdw.writeClassRecord( cr ); 98 99 } 101 102 103 public void testClose1() throws Exception 104 { 105 IClassMetaDataWriter cmdw = createIClassMetaDataWriter(); 106 cmdw.close(); 107 } 108 109 110 public void testClose2() throws Exception 111 { 112 IClassMetaDataWriter cmdw = createIClassMetaDataWriter(); 113 ModifiedClass mc = CCCreatorUtil.createModifiedClass( THIS_CLASS ); 114 ClassRecord cr = mc.createClassRecord( AMS ); 115 cmdw.close(); 116 117 try 118 { 119 cmdw.writeClassRecord( cr ); 120 fail( "Did not throw IOException." ); 121 } 122 catch (IOException ex) 123 { 124 } 126 } 127 128 129 public void testClose3() throws Exception 130 { 131 IClassMetaDataWriter cmdw = createIClassMetaDataWriter(); 132 cmdw.close(); 133 134 try 135 { 136 cmdw.writeClassRecord( null ); 137 fail( "Did not throw IllegalArgumentException or IOException." ); 138 } 139 catch (IllegalArgumentException ex) 141 { 142 } 144 catch (IOException ex) 145 { 146 } 148 } 149 150 151 public void testClose4() throws Exception 152 { 153 IClassMetaDataWriter cmdw = createIClassMetaDataWriter(); 154 cmdw.close(); 155 156 try 157 { 158 cmdw.close(); 159 fail( "Did not throw IOException." ); 160 } 161 catch (IOException ex) 162 { 163 } 165 } 166 167 168 169 172 173 public static InterfaceTestSuite suite() 174 { 175 InterfaceTestSuite suite = new InterfaceTestSuite( THIS_CLASS ); 176 177 return suite; 178 } 179 180 public static void main( String [] args ) 181 { 182 String [] name = { THIS_CLASS.getName() }; 183 184 187 junit.textui.TestRunner.main( name ); 188 } 189 190 191 195 protected void setUp() throws Exception 196 { 197 super.setUp(); 198 199 } 201 202 203 207 protected void tearDown() throws Exception 208 { 209 211 212 super.tearDown(); 213 } 214 } 215 216 | Popular Tags |