Class ProviderFactory.ProviderProxy

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ProviderProxy​(java.lang.Object providerInOtherClassLoader, java.lang.ClassLoader testsClassLoader)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void cancel()
      Makes an attempt at cancelling the current run, giving the provider a chance to notify reporting that the remaining tests have been cancelled due to timeout.
      java.lang.Iterable<java.lang.Class<?>> getSuites()
      Determines the number of forks.
      RunResult invoke​(java.lang.Object forkTestSet)
      Runs a forked test
      private java.lang.ClassLoader swapClassLoader​(java.lang.ClassLoader newClassLoader)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • providerInOtherClassLoader

        private final java.lang.Object providerInOtherClassLoader
      • testsClassLoader

        private final java.lang.ClassLoader testsClassLoader
    • Constructor Detail

      • ProviderProxy

        private ProviderProxy​(java.lang.Object providerInOtherClassLoader,
                              java.lang.ClassLoader testsClassLoader)
    • Method Detail

      • getSuites

        public java.lang.Iterable<java.lang.Class<?>> getSuites()
        Description copied from interface: SurefireProvider
        Determines the number of forks.
        Called when forkmode is different from "never" or "always", allows the provider to define how to behave for the fork.
        Specified by:
        getSuites in interface SurefireProvider
        Returns:
        An iterator that will trigger one fork per item
      • invoke

        public RunResult invoke​(java.lang.Object forkTestSet)
                         throws ReporterException,
                                java.lang.reflect.InvocationTargetException
        Description copied from interface: SurefireProvider
        Runs a forked test
        Specified by:
        invoke in interface SurefireProvider
        Parameters:
        forkTestSet - An item from the iterator in #getSuites. Will be null for forkmode never or always. When this is non-null, the forked process will run only that test and probably not scan the classpath
        Returns:
        A result of the invocation
        Throws:
        ReporterException - When reporting fails
        java.lang.reflect.InvocationTargetException - fails in ProviderFactory
      • swapClassLoader

        private java.lang.ClassLoader swapClassLoader​(java.lang.ClassLoader newClassLoader)
      • cancel

        public void cancel()
        Description copied from interface: SurefireProvider
        Makes an attempt at cancelling the current run, giving the provider a chance to notify reporting that the remaining tests have been cancelled due to timeout.
        If the provider thinks it can terminate properly it is the responsibility of the invoke method to return a RunResult with a booter code of failure.
        It is up to the provider to find out how to implement this method properly. A provider may also choose to not do anything at all in this method, which means surefire will kill the forked process soon afterwards anyway.
        Will be called on a different thread than the one calling invoke.
        Specified by:
        cancel in interface SurefireProvider