org.jnario.lib
Class AbstractSpecCreator

java.lang.Object
  extended by org.jnario.lib.AbstractSpecCreator
All Implemented Interfaces:
SpecCreator
Direct Known Subclasses:
SimpleSpecCreator

public abstract class AbstractSpecCreator
extends Object
implements SpecCreator


Constructor Summary
AbstractSpecCreator()
           
 
Method Summary
 void afterSpecRun()
          Callback that is called after the spec is executed.
 void beforeSpecRun()
          Callback that is called before the spec is executed.
protected abstract
<T> T
create(Class<T> klass)
           
<T> T
createSpec(Class<T> klass)
          Creates a spec or feature instance.
<T> T
createSubject(Class<T> klass)
          Creates the subject of a spec.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSpecCreator

public AbstractSpecCreator()
Method Detail

createSpec

public <T> T createSpec(Class<T> klass)
Description copied from interface: SpecCreator
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}.

Specified by:
createSpec in interface SpecCreator
Parameters:
klass - the spec type
Returns:
a new instance of the spec

createSubject

public <T> T createSubject(Class<T> klass)
Description copied from interface: SpecCreator
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}.

Specified by:
createSubject in interface SpecCreator
Parameters:
klass - the subject type
Returns:
a new instance of the subject

create

protected abstract <T> T create(Class<T> klass)

beforeSpecRun

public void beforeSpecRun()
Description copied from interface: SpecCreator
Callback that is called before the spec is executed.

Specified by:
beforeSpecRun in interface SpecCreator

afterSpecRun

public void afterSpecRun()
Description copied from interface: SpecCreator
Callback that is called after the spec is executed.

Specified by:
afterSpecRun in interface SpecCreator


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