org.powermock.tests.utils
Interface TestSuiteChunker

All Known Implementing Classes:
AbstractTestSuiteChunkerImpl

public interface TestSuiteChunker

An interface that should be implemented by classes that performs test suite chunking. Test suite chunking may be performed because certain classes may need to be byte-code manipulated in tests without impacting on other tests.

Author:
Johan Haleby

Method Summary
 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.
 List<TestChunk> getTestChunks()
          Get all chunk entries.
 List<TestChunk> getTestChunksEntries(Class<?> testClass)
          Get all chunk entries for a specific class.
 int getTestCount()
          Get the number of total tests defined in the suite (the sum of all tests defined in all chunks for this suite).
 boolean shouldExecuteTestForMethod(Class<?> testClass, Method potentialTestMethod)
          Should reflect whether or not this method is eligible for testing.
 

Method Detail

createTestDelegators

void createTestDelegators(Class<?> testClass,
                          List<TestChunk> chunks)
                          throws Exception
Create the test delegators needed for a whole class.

Throws:
Exception

getChunkSize

int getChunkSize()
Get the number of chunks defined in this suite.

Returns:
The number of chunks defined in the correct suite.

getTestChunks

List<TestChunk> getTestChunks()
Get all chunk entries.

Returns:
An set of entries that contains a list of methods contained in the chunk and the class loader that loaded these methods.

getTestChunksEntries

List<TestChunk> getTestChunksEntries(Class<?> testClass)
Get all chunk entries for a specific class.

Parameters:
testClass - The class whose chunk entries to get.
Returns:
An set of entries that contains a list of methods contained in the chunk for the specific test class and the class loader that loaded these methods.

shouldExecuteTestForMethod

boolean shouldExecuteTestForMethod(Class<?> testClass,
                                   Method potentialTestMethod)
Should reflect whether or not this method is eligible for testing.

Parameters:
testClass - The class that defines the method.
potentialTestMethod - The method to inspect whether it should be executed in the test suite or not.
Returns:
true if the method is a test method and should be executed, false otherwise.

createNewClassloader

ClassLoader createNewClassloader(Class<?> testClass,
                                 String[] classesToLoadByMockClassloader,
                                 String[] packagesToIgnore)
Create a new class loader and load classes from this classloader.

Parameters:
testClass - TODO
classesToLoadByMockClassloader - An array of the fully qualified name of the classes to modify.
packagesToIgnore - Packages to ignore.

getTestCount

int getTestCount()
Get the number of total tests defined in the suite (the sum of all tests defined in all chunks for this suite).

Returns:
The number of tests in this suite.


Copyright © 2007-2013. All Rights Reserved.