Package org.powermock.tests.utils.impl
Class AbstractTestClassExtractor
- java.lang.Object
-
- org.powermock.tests.utils.impl.AbstractTestClassExtractor
-
- All Implemented Interfaces:
TestClassesExtractor
- Direct Known Subclasses:
PrepareForTestExtractorImpl
,StaticConstructorSuppressExtractorImpl
public abstract class AbstractTestClassExtractor extends java.lang.Object implements TestClassesExtractor
Base class for all test class extractors.
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
includeMethods
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractTestClassExtractor()
protected
AbstractTestClassExtractor(boolean includeMethods)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private void
extractClassesAndAddThemToList(java.lang.reflect.AnnotatedElement elementToExtractClassFrom, java.util.Set<java.lang.String> classesToPrepareForTest)
private void
extractClassesFromTestClass(java.lang.Class<?> element, java.util.Set<java.lang.String> classesToPrepareForTest)
protected abstract java.lang.String[]
getClassesToModify(java.lang.reflect.AnnotatedElement element)
Get the fully qualified names for classes that must should be modified for thiselement
.java.lang.String[]
getTestClasses(java.lang.reflect.AnnotatedElement element)
Ifelement
is a class this method traverses the hierarchy and extracts classes that should be prepared for test in all super classes.boolean
isPrepared(java.lang.reflect.AnnotatedElement element, java.lang.String fullyQualifiedClassName)
private java.util.Collection<java.lang.String>
lookOverMethods(java.lang.Class<?> classToInvestigate)
-
-
-
Method Detail
-
getTestClasses
public final java.lang.String[] getTestClasses(java.lang.reflect.AnnotatedElement element)
Ifelement
is a class this method traverses the hierarchy and extracts classes that should be prepared for test in all super classes.- Specified by:
getTestClasses
in interfaceTestClassesExtractor
- Returns:
- Returns
null
if the element was not annotated, an empty String[] if it is annotated but contains no classes, or a string-array of all class names if interest.
-
extractClassesFromTestClass
private void extractClassesFromTestClass(java.lang.Class<?> element, java.util.Set<java.lang.String> classesToPrepareForTest)
-
lookOverMethods
private java.util.Collection<java.lang.String> lookOverMethods(java.lang.Class<?> classToInvestigate)
-
extractClassesAndAddThemToList
private void extractClassesAndAddThemToList(java.lang.reflect.AnnotatedElement elementToExtractClassFrom, java.util.Set<java.lang.String> classesToPrepareForTest)
-
getClassesToModify
protected abstract java.lang.String[] getClassesToModify(java.lang.reflect.AnnotatedElement element)
Get the fully qualified names for classes that must should be modified for thiselement
.- Parameters:
element
- The element that may contain info regarding which classes that must be modified by PowerMock.- Returns:
- An array of fully-qualified names to classes that must be
modified by PowerMock for the specific
element
.
-
isPrepared
public boolean isPrepared(java.lang.reflect.AnnotatedElement element, java.lang.String fullyQualifiedClassName)
- Specified by:
isPrepared
in interfaceTestClassesExtractor
-
-