| java.lang.Object org.netbeans.modules.junit.AbstractTestGenerator
All known Subclasses: org.netbeans.modules.junit.JUnit3TestGenerator, org.netbeans.modules.junit.JUnit4TestGenerator,
AbstractTestGenerator | abstract class AbstractTestGenerator implements CancellableTask<WorkingCopy>(Code) | | A base class for generators of JUnit test classes and test methods.
author: Marian Petras |
Method Summary | |
protected static EnumSet<Modifier> | accessModifiers() Returns
EnumSet of all access modifiers. | public void | cancel() Stops this creator - cancels creation of a test class. | abstract protected ClassTree | composeNewTestClass(WorkingCopy workingCopy, String name, List<? extends Tree> members) Generates a new test class containing the given list of test methods. | abstract protected MethodTree | composeNewTestMethod(String testMethodName, BlockTree testMethodBody, List<ExpressionTree> throwsList, WorkingCopy workingCopy) | static Set<Modifier> | createModifierSet(Modifier... modifiers) Creates a
Set of
Modifier s from the given list
of modifiers. | protected ModifiersTree | createModifiersTree(String annotationClassName, Set<Modifier> modifiers, WorkingCopy workingCopy) | abstract protected ClassTree | finishSuiteClass(ClassTree tstClass, TreePath tstClassTreePath, List<Tree> tstMembers, List<String> suiteMembers, boolean membersChanged, ClassMap classMap, WorkingCopy workingCopy) | abstract protected List<? extends Tree> | generateInitMembers(WorkingCopy workingCopy) | abstract protected ClassTree | generateMissingInitMembers(ClassTree tstClass, TreePath tstClassTreePath, WorkingCopy workingCopy) Generates missing set-up and tear-down methods in the given test class. | abstract protected boolean | generateMissingInitMembers(List<Tree> tstMembers, ClassMap clsMap, WorkingCopy workingCopy) Generates missing set-up and tear-down methods and adds them to the list
of class members. | abstract protected void | generateMissingPostInitMethods(TreePath tstClassTreePath, List<Tree> tstMembers, ClassMap clsMap, WorkingCopy workingCopy) | protected ClassTree | generateMissingTestMethods(TypeElement srcClass, List<ExecutableElement> srcMethods, ClassTree tstClass, TreePath tstClassTreePath, boolean generateMissingInitMembers, WorkingCopy workingCopy) | protected MethodTree | generateTestMethod(TypeElement srcClass, ExecutableElement srcMethod, String testMethodName, boolean useNoArgConstructor, WorkingCopy workingCopy) Generates a test methods for the given source method. | protected BlockTree | generateTestMethodBody(TypeElement srcClass, ExecutableElement srcMethod, boolean useNoArgConstructor, WorkingCopy workingCopy) Generates a default body of a test method. | protected ExpressionTree | getClassIdentifierTree(String className, WorkingCopy workingCopy) | protected static TypeElement | getElemForClassName(String className, Elements elements) | protected int | getPlaceForFirstInitMethod(ClassMap clsMap) Finds position for the first init method. | List<String> | getProcessedClassNames() | protected boolean | hasAccessibleNoArgConstructor(TypeElement srcClass) | protected static EnumSet<Modifier> | noModifiers() Returns an empty
EnumSet of
Modifier s. | public void | run(WorkingCopy workingCopy) |
AbstractTestGenerator | protected AbstractTestGenerator(TestGeneratorSetup setup)(Code) | | Used when creating a new empty test class.
|
AbstractTestGenerator | protected AbstractTestGenerator(TestGeneratorSetup setup, List<ElementHandle<TypeElement>> srcTopClassHandles, List<String> suiteMembers, boolean isNewTestClass)(Code) | | Used when creating a test class for a given source class
or when creating a test suite.
|
accessModifiers | protected static EnumSet<Modifier> accessModifiers()(Code) | | Returns
EnumSet of all access modifiers.
EnumSet of all access modifiers;it is guaranteed that the returned set always containsthe same set of Modifier s, but the returnedinstance may not always be the same |
cancel | public void cancel()(Code) | | Stops this creator - cancels creation of a test class.
|
composeNewTestClass | abstract protected ClassTree composeNewTestClass(WorkingCopy workingCopy, String name, List<? extends Tree> members)(Code) | | Generates a new test class containing the given list of test methods.
Parameters: name - desired name of the test class Parameters: members - desired content of the test class generated test class |
composeNewTestMethod | abstract protected MethodTree composeNewTestMethod(String testMethodName, BlockTree testMethodBody, List<ExpressionTree> throwsList, WorkingCopy workingCopy)(Code) | | |
createModifierSet | static Set<Modifier> createModifierSet(Modifier... modifiers)(Code) | | Creates a
Set of
Modifier s from the given list
of modifiers.
Parameters: modifiers - modifiers that should be contained in the set set containing exactly the given modifiers |
createModifiersTree | protected ModifiersTree createModifiersTree(String annotationClassName, Set<Modifier> modifiers, WorkingCopy workingCopy)(Code) | | |
finishSuiteClass | abstract protected ClassTree finishSuiteClass(ClassTree tstClass, TreePath tstClassTreePath, List<Tree> tstMembers, List<String> suiteMembers, boolean membersChanged, ClassMap classMap, WorkingCopy workingCopy)(Code) | | |
generateInitMembers | abstract protected List<? extends Tree> generateInitMembers(WorkingCopy workingCopy)(Code) | | |
generateMissingInitMembers | abstract protected ClassTree generateMissingInitMembers(ClassTree tstClass, TreePath tstClassTreePath, WorkingCopy workingCopy)(Code) | | Generates missing set-up and tear-down methods in the given test class.
Parameters: tstClass - test class in which the methods should be generated a class tree with the missing methods added;or the passed class tree if no method was missing |
generateMissingInitMembers | abstract protected boolean generateMissingInitMembers(List<Tree> tstMembers, ClassMap clsMap, WorkingCopy workingCopy)(Code) | | Generates missing set-up and tear-down methods and adds them to the list
of class members.
Parameters: tstMembers - current list of test class members- generated members will be added to it Parameters: clsMap - index of the test class contents- it will be updated if some members are addedto the list true if the list of members was modified, false otherwise |
generateMissingPostInitMethods | abstract protected void generateMissingPostInitMethods(TreePath tstClassTreePath, List<Tree> tstMembers, ClassMap clsMap, WorkingCopy workingCopy)(Code) | | |
generateMissingTestMethods | protected ClassTree generateMissingTestMethods(TypeElement srcClass, List<ExecutableElement> srcMethods, ClassTree tstClass, TreePath tstClassTreePath, boolean generateMissingInitMembers, WorkingCopy workingCopy)(Code) | | Parameters: srcMethods - methods to create/update tests for |
generateTestMethod | protected MethodTree generateTestMethod(TypeElement srcClass, ExecutableElement srcMethod, String testMethodName, boolean useNoArgConstructor, WorkingCopy workingCopy)(Code) | | Generates a test methods for the given source method.
Parameters: srcClass - source class - parent of the source method Parameters: srcMethod - source method for which the test method should becreated Parameters: useNoArgConstrutor - whether a no-argument constructor should beused in the default test method body;it should not be true unlessthe source class contains an accessibleno-argument constructor the generated test method |
generateTestMethodBody | protected BlockTree generateTestMethodBody(TypeElement srcClass, ExecutableElement srcMethod, boolean useNoArgConstructor, WorkingCopy workingCopy)(Code) | | Generates a default body of a test method.
Parameters: srcClass - class - parent of the tested source method Parameters: srcMethod - source method which should be tested by the test Parameters: useNoArgConstrutor - whether a no-argument constructor should beused in the body;it should not be true unlessthe source class contains an accessibleno-argument constructor |
getClassIdentifierTree | protected ExpressionTree getClassIdentifierTree(String className, WorkingCopy workingCopy)(Code) | | |
getPlaceForFirstInitMethod | protected int getPlaceForFirstInitMethod(ClassMap clsMap)(Code) | | Finds position for the first init method.
Parameters: clsMap - index of the test class contents index where the first init method should be put,or -1 if the method should be put to the endof the class |
hasAccessibleNoArgConstructor | protected boolean hasAccessibleNoArgConstructor(TypeElement srcClass)(Code) | | |
noModifiers | protected static EnumSet<Modifier> noModifiers()(Code) | | Returns an empty
EnumSet of
Modifier s.
empty EnumSet of all Modifier s;it is guaranteed that the returned set is always emptybut the returned instance may not always be the same |
|
|