1 19 20 package org.netbeans.modules.junit.plugin; 21 22 import java.util.Map ; 25 import org.netbeans.modules.junit.JUnitPluginTrampoline; 30 import org.openide.filesystems.FileObject; 31 32 45 public abstract class JUnitPlugin { 46 47 static { 48 JUnitPluginTrampoline.DEFAULT = new JUnitPluginTrampoline() { 49 public FileObject[] createTests( 50 JUnitPlugin plugin, 51 FileObject[] filesToTest, 52 FileObject targetRoot, 53 Map <CreateTestParam,Object > params) { 54 return plugin.createTests(filesToTest, targetRoot, params); 55 } 56 public Location getTestLocation( 57 JUnitPlugin plugin, 58 Location sourceLocation) { 59 return plugin.getTestLocation(sourceLocation); 60 } 61 public Location getTestedLocation( 62 JUnitPlugin plugin, 63 Location testLocation) { 64 return plugin.getTestedLocation(testLocation); 65 } 66 }; 67 } 68 69 72 protected JUnitPlugin() {} 73 74 77 public enum CreateTestParam { 78 79 83 CLASS_NAME(99310), 84 88 INC_PUBLIC(99311), 89 93 INC_PROTECTED(99312), 94 98 INC_PKG_PRIVATE(99313), 99 103 INC_SETUP(99314), 104 108 INC_TEAR_DOWN(99315), 109 113 INC_METHOD_BODIES(99316), 114 118 INC_JAVADOC(99317), 119 123 INC_CODE_HINT(99318), 124 128 INC_PKG_PRIVATE_CLASS(99319), 129 133 INC_ABSTRACT_CLASS(99320), 134 138 INC_EXCEPTION_CLASS(99321), 139 143 INC_GENERATE_SUITE(99322); 144 145 private final int idNumber; 146 147 CreateTestParam(int idNumber) { 148 this.idNumber = idNumber; 149 } 150 151 156 public int getIdNumber() { 157 return idNumber; 158 } 159 160 } 161 162 166 public static final class Location { 167 174 private final FileObject fileObject; 175 191 199 public Location(FileObject fileObject) { 201 if (fileObject == null) { 202 throw new IllegalArgumentException ("fileObject is null"); } 204 205 210 this.fileObject = fileObject; 211 } 215 216 221 public FileObject getFileObject() { 222 return fileObject; 223 } 224 225 231 } 232 233 241 protected abstract Location getTestLocation(Location sourceLocation); 242 243 251 protected abstract Location getTestedLocation(Location testLocation); 252 253 265 283 protected abstract FileObject[] createTests( 284 FileObject[] filesToTest, 285 FileObject targetRoot, 286 Map <CreateTestParam, Object > params); 287 288 } 289 | Popular Tags |