Package org.spockframework.runtime
Class SpecUtil
java.lang.Object
org.spockframework.runtime.SpecUtil
Utility methods related to specifications. Particularly useful when
integrating Spock with other environments (e.g. Grails).
- Author:
- Peter Niederwieser
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkIsRunnableSpec
(Class<?> clazz) static void
checkIsSpec
(Class<?> clazz) Checks if the given class is a Spock specification (according to isSpec()), and throws an InvalidSpecException with a detailed explanation if it is not.static <T> T
getConfiguration
(Class<T> type) static int
getFeatureCount
(Class<?> spec) Returns the number of features contained in the given specification.static boolean
isRunnableSpec
(Class<?> clazz) static boolean
Tells if the given class is a Spock specification.optimizeRunOrder
(List<String> specNames)
-
Method Details
-
isSpec
Tells if the given class is a Spock specification. Might return false even though the class implements spock.lang.Specification. This can happen if the class wasn't compiled properly (i.e. Spock's AST transform wasn't run). -
checkIsSpec
Checks if the given class is a Spock specification (according to isSpec()), and throws an InvalidSpecException with a detailed explanation if it is not. -
isRunnableSpec
-
checkIsRunnableSpec
-
getFeatureCount
Returns the number of features contained in the given specification. Because Spock allows for the dynamic creation of new features at specification run time, this number is only an estimate. -
optimizeRunOrder
-
getConfiguration
-