org.jnario.runner
Interface SpecCreator

All Known Implementing Classes:
AbstractSpecCreator, SimpleSpecCreator

public interface SpecCreator

A factory for creating features or specs together with their subjects. It can be used to customize the creation of a specification to use, for example, to use a dependency injection container or a mocking framework. Implementations should override AbstractSpecCreator.

Author:
Sebastian Benz - Initial contribution and API

Method Summary
 void afterSpecRun()
          Callback that is called after the spec is executed.
 void beforeSpecRun()
          Callback that is called before the spec is executed.
<T> T
createSpec(Class<T> klass)
          Creates a spec or feature instance.
<T> T
createSubject(Class<T> klass)
          Creates the subject of a spec.
 

Method Detail

createSpec

<T> T createSpec(Class<T> klass)
Creates a spec or feature instance. For example, given the following spec:
 describe Greeter{
   fact subject.sayHello() => "Hello World"
 }
 
the parameter klass will be the generated {@code GreeterSpec} class and this method should return an instance of {@code GreeterSpec}.

Parameters:
klass - the spec type
Returns:
a new instance of the spec

createSubject

<T> T createSubject(Class<T> klass)
Creates the subject of a spec. For example, given the following spec:
 describe Greeter{
   fact subject.sayHello() => "Hello World"
 }
 
the parameter klass will be the subject's class {@code Greeter} and this method should return an instance of {@code Greeter}.

Parameters:
klass - the subject type
Returns:
a new instance of the subject

beforeSpecRun

void beforeSpecRun()
Callback that is called before the spec is executed.


afterSpecRun

void afterSpecRun()
Callback that is called after the spec is executed.



Copyright © 2012-2013 BMW Car IT. All Rights Reserved.