Class JunitApiExecutor


  • public class JunitApiExecutor
    extends java.lang.Object
    Executes registered extensions.

    Mostly a copy of ClassBasedTestDescriptor and TestMethodTestDescriptor logic.

    Note that in jupiter all such logic is aggregated in descriptors because they have to do all the work of methods execution. But spock do most of it already and that's why descriptors concept wasn't used at all. Essentially, this class contains all required code (plus ExtensionUtils).

    Contexts are more equal to jupiter analog, but in context of spock much less context types is required (and overall amount of possible execution scenarios is less than in jupiter because there is no templates and nested tests).

    ThrowableCollector concept is very limited comparing to jupiter: there it used for everything, because descriptors control all flow, but here, collectors used only for exceptions detection in extensions (and to make callbacks processing logic more equal to the original source). Also, that's why exception handler extensions are not supported (it is possible, but not so important).

    Since:
    28.12.2021
    • Constructor Detail

      • JunitApiExecutor

        public JunitApiExecutor()
    • Method Detail

      • beforeAll

        public void beforeAll​(ClassContext context)
      • instancePostProcessors

        public void instancePostProcessors​(ClassContext context,
                                           java.lang.Object instance)
      • beforeTestExecution

        public void beforeTestExecution​(MethodContext context)
      • afterTestExecution

        public void afterTestExecution​(MethodContext context)
      • instancePreDestroy

        public void instancePreDestroy​(MethodContext context)
      • handleTestException

        public void handleTestException​(MethodContext context,
                                        java.lang.Throwable error)