Package org.spockframework.runtime
Class SpecUtil
- java.lang.Object
-
- org.spockframework.runtime.SpecUtil
-
public final class SpecUtil extends java.lang.Object
Utility methods related to specifications. Particularly useful when integrating Spock with other environments (e.g. Grails).- Author:
- Peter Niederwieser
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
checkIsRunnableSpec(java.lang.Class<?> clazz)
static void
checkIsSpec(java.lang.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(java.lang.Class<T> type)
static int
getFeatureCount(java.lang.Class<?> spec)
Returns the number of features contained in the given specification.static boolean
isRunnableSpec(java.lang.Class<?> clazz)
static boolean
isSpec(java.lang.Class<?> clazz)
Tells if the given class is a Spock specification.static java.util.List<java.lang.String>
optimizeRunOrder(java.util.List<java.lang.String> specNames)
-
-
-
Method Detail
-
isSpec
public static boolean isSpec(java.lang.Class<?> clazz)
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
public static void checkIsSpec(java.lang.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.
-
isRunnableSpec
public static boolean isRunnableSpec(java.lang.Class<?> clazz)
-
checkIsRunnableSpec
public static void checkIsRunnableSpec(java.lang.Class<?> clazz)
-
getFeatureCount
public static int getFeatureCount(java.lang.Class<?> spec)
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
public static java.util.List<java.lang.String> optimizeRunOrder(java.util.List<java.lang.String> specNames)
-
getConfiguration
public static <T> T getConfiguration(java.lang.Class<T> type)
-
-