|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.powermock.tests.utils.impl.AbstractTestSuiteChunkerImpl<T>
public abstract class AbstractTestSuiteChunkerImpl<T>
Abstract base class for test suite chunking, i.e. a suite is chunked into
several smaller pieces which are ran with different classloaders. A chunk is
defined by the PrepareForTest annotation. This to make sure that you
can byte-code manipulate classes in tests without impacting on other tests.
| Field Summary | |
|---|---|
protected List<T> |
delegates
|
protected Set<Class<?>> |
delegatesCreatedForTheseClasses
|
protected static int |
NOT_INITIALIZED
|
protected TestClassesExtractor |
prepareForTestExtractor
|
protected TestClassesExtractor |
suppressionExtractor
|
protected LinkedHashMap<Integer,List<Integer>> |
testAtDelegateMapper
|
protected int |
testCount
|
| Constructor Summary | |
|---|---|
protected |
AbstractTestSuiteChunkerImpl(Class<?>... testClasses)
|
protected |
AbstractTestSuiteChunkerImpl(Class<?> testClass)
|
| Method Summary | |
|---|---|
protected void |
chunkClass(Class<?> testClass)
|
protected abstract T |
createDelegatorFromClassloader(ClassLoader classLoader,
Class<?> testClass,
List<Method> methodsToTest)
|
ClassLoader |
createNewClassloader(Class<?> testClass,
String[] classesToLoadByMockClassloader,
String[] packagesToIgnore)
Create a new class loader and load classes from this
classloader. |
void |
createTestDelegators(Class<?> testClass,
List<TestChunk> chunks)
Create the test delegators needed for a whole class. |
int |
getChunkSize()
Get the number of chunks defined in this suite. |
int |
getDelegatorIndex(int testIndex)
Get the junit runner delegate that handles the test at index testIndex. |
int |
getInternalTestIndex(int originalTestIndex)
Get the internal test index for a junit runner delegate based on the "real" original test index. |
protected Object |
getPowerMockTestListenersLoadedByASpecificClassLoader(Class<?> clazz,
ClassLoader classLoader)
|
List<TestChunk> |
getTestChunks()
Get all chunk entries. |
List<TestChunk> |
getTestChunksEntries(Class<?> testClass)
Get all chunk entries for a specific class. |
Class<?>[] |
getTestClasses()
|
protected boolean |
hasMockPolicyProvidedClasses(Class<?> testClass)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.powermock.tests.utils.TestSuiteChunker |
|---|
getTestCount, shouldExecuteTestForMethod |
| Field Detail |
|---|
protected static final int NOT_INITIALIZED
protected final TestClassesExtractor prepareForTestExtractor
protected final TestClassesExtractor suppressionExtractor
protected final Set<Class<?>> delegatesCreatedForTheseClasses
protected final List<T> delegates
protected final LinkedHashMap<Integer,List<Integer>> testAtDelegateMapper
protected volatile int testCount
| Constructor Detail |
|---|
protected AbstractTestSuiteChunkerImpl(Class<?> testClass)
throws Exception
Exception
protected AbstractTestSuiteChunkerImpl(Class<?>... testClasses)
throws Exception
Exception| Method Detail |
|---|
protected Object getPowerMockTestListenersLoadedByASpecificClassLoader(Class<?> clazz,
ClassLoader classLoader)
protected void chunkClass(Class<?> testClass)
throws Exception
Exception
public ClassLoader createNewClassloader(Class<?> testClass,
String[] classesToLoadByMockClassloader,
String[] packagesToIgnore)
TestSuiteChunkerclasses from this
classloader.
createNewClassloader in interface TestSuiteChunkertestClass - TODOclassesToLoadByMockClassloader - An array of the fully qualified name of the classes to modify.packagesToIgnore - Packages to ignore.
public void createTestDelegators(Class<?> testClass,
List<TestChunk> chunks)
throws Exception
createTestDelegators in interface TestSuiteChunkerException
protected abstract T createDelegatorFromClassloader(ClassLoader classLoader,
Class<?> testClass,
List<Method> methodsToTest)
throws Exception
Exceptionpublic int getChunkSize()
TestSuiteChunker
getChunkSize in interface TestSuiteChunkerpublic List<TestChunk> getTestChunks()
TestSuiteChunker
getTestChunks in interface TestSuiteChunkerpublic int getInternalTestIndex(int originalTestIndex)
originalTestIndex - The original test index as seen by the test runner.
-1
if no index was found.public int getDelegatorIndex(int testIndex)
testIndex. Throws a RuntimeException if a delegator
is not found for the specific test index.
testIndex - The test index that a delegator should hold.
public List<TestChunk> getTestChunksEntries(Class<?> testClass)
getTestChunksEntries in interface TestSuiteChunkertestClass - The class whose chunk entries to get.
public Class<?>[] getTestClasses()
protected boolean hasMockPolicyProvidedClasses(Class<?> testClass)
true if there are some mock policies that
contributes with classes that should be loaded by the mock
classloader, false otherwise.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||