Class JUnitFixtureMethodsExtension
- java.lang.Object
-
- org.spockframework.runtime.extension.builtin.JUnitFixtureMethodsExtension
-
- All Implemented Interfaces:
IGlobalExtension
public class JUnitFixtureMethodsExtension extends java.lang.Object implements IGlobalExtension
Adapts the JUnitBefore
,After
,BeforeClass
andAfterClass
fixture mechanism to Spock.The method signature requirements that JUnit has for fixture methods apply exactly to Spock as well. That is, fixture methods must return
void
, must take no arguments and must bepublic
. Moreover,Before
andAfter
fixture methods must be instance methods whileBeforeClass
andAfterClass
fixture methods must be static. Any methods that do not meet the requirements will be silently ignored.BeforeClass
fixture methods will be executed once before any feature methods orBefore
orsetup()
methods, and before thesetupSpec()
method (if present). Inheritance semantics are identical tosetupSpec()
, i.e. methods are executed for each class in the hierarchy in turn from parent to child.Before
fixture methods will be executed before every feature method and before thesetup()
method (if present). Inheritance semantics are identical tosetup()
, i.e. methods are executed for each class in the hierarchy in turn from parent to child.After
fixture methods will be executed after every feature method and after thecleanup()
method (if present). Inheritance semantics are identical tocleanup()
, i.e. methods are executed for each class in the hierarchy in turn from child to parent.AfterClass
fixture methods will be executed once after all feature methods and afterAfter
andcleanup()
methods, and after thecleanupSpec()
method (if present). Inheritance semantics are identical tocleanupSpec()
, i.e. methods are executed for each class in the hierarchy in turn from child to parent.The execution order of fixture methods of the same type withing the same class is undefined (as it is with JUnit).
- Author:
- Luke Daley
-
-
Constructor Summary
Constructors Constructor Description JUnitFixtureMethodsExtension()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
visitSpec(SpecInfo spec)
-
-
-
Method Detail
-
visitSpec
public void visitSpec(SpecInfo spec)
- Specified by:
visitSpec
in interfaceIGlobalExtension
-
-