Class AbstractTestSuiteChunkerImpl<T>

    • Field Detail

      • delegatesCreatedForTheseClasses

        protected final java.util.Set<java.lang.Class<?>> delegatesCreatedForTheseClasses
      • delegates

        protected final java.util.List<T> delegates
      • testCount

        protected volatile int testCount
    • Constructor Detail

      • AbstractTestSuiteChunkerImpl

        protected AbstractTestSuiteChunkerImpl​(java.lang.Class<?> testClass)
                                        throws java.lang.Exception
        Throws:
        java.lang.Exception
      • AbstractTestSuiteChunkerImpl

        protected AbstractTestSuiteChunkerImpl​(java.lang.Class<?>... testClasses)
                                        throws java.lang.Exception
        Throws:
        java.lang.Exception
    • Method Detail

      • getPowerMockTestListenersLoadedByASpecificClassLoader

        protected java.lang.Object getPowerMockTestListenersLoadedByASpecificClassLoader​(java.lang.Class<?> clazz,
                                                                                         java.lang.ClassLoader classLoader)
      • createTestDelegators

        public final void createTestDelegators​(java.lang.Class<?> testClass,
                                               java.util.List<TestChunk> chunks)
                                        throws java.lang.Exception
        Description copied from interface: RunnerTestSuiteChunker
        Create the test delegators needed for a whole class.
        Specified by:
        createTestDelegators in interface RunnerTestSuiteChunker
        Throws:
        java.lang.Exception
      • createDelegatorFromClassloader

        protected abstract T createDelegatorFromClassloader​(java.lang.ClassLoader classLoader,
                                                            java.lang.Class<?> testClass,
                                                            java.util.List<java.lang.reflect.Method> methodsToTest)
                                                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getInternalTestIndex

        public int getInternalTestIndex​(int originalTestIndex)
        Get the internal test index for a junit runner delegate based on the "real" original test index. For example, the test may need to run a single test, for example the test with index 3. However since PowerMock may have chunked the test suite to use many classloaders and junit delegators the index (3) must be mapped to an internal representation for the specific junit runner delegate. This is what this method does. I.e. it will iterate through all junit runner delegates and see if they contain the test with index 3, in the internal index of this test delegator is returned.
        Parameters:
        originalTestIndex - The original test index as seen by the test runner.
        Returns:
        The internal test index as seen by PowerMock or -1 if no index was found.
      • getDelegatorIndex

        public int getDelegatorIndex​(int testIndex)
        Get the junit runner delegate that handles the test at index testIndex. Throws a RuntimeException if a delegator is not found for the specific test index.
        Parameters:
        testIndex - The test index that a delegator should hold.
        Returns:
        The index for of the junit runner delegate as seen by JTestRack.
      • getTestClasses

        protected java.lang.Class<?>[] getTestClasses()