org.spockframework.runtime
Class SpecUtil

java.lang.Object
  extended by org.spockframework.runtime.SpecUtil

public final class SpecUtil
extends Object

Utility methods related to specifications. Particularly useful when integrating Spock with other environments (e.g. Grails).

Author:
Peter Niederwieser

Method Summary
static 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 int getFeatureCount(Class<?> spec)
          Returns the number of features contained in the given specification.
static boolean isRunnableSpec(Class<?> clazz)
           
static boolean isSpec(Class<?> clazz)
          Tells if the given class is a Spock specification.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isSpec

public static boolean isSpec(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(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(Class<?> clazz)

checkIsRunnableSpec

public static void checkIsRunnableSpec(Class<?> clazz)

getFeatureCount

public static int getFeatureCount(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.



Copyright © 2010. All Rights Reserved.