org.specrunner.junit
Class SpecRunnerStatement

java.lang.Object
  extended by org.junit.runners.model.Statement
      extended by org.specrunner.junit.SpecRunnerStatement

public class SpecRunnerStatement
extends org.junit.runners.model.Statement

Generic statement for SpecRunner Junit extensions.

Author:
Thiago Santos

Field Summary
protected  File input
          The input file.
protected  Object instance
          The test instance.
protected  List<INodeListener> listeners
          Listener to activate.
protected  File output
          The output file.
protected  org.junit.runners.model.TestClass test
          The test class.
 
Constructor Summary
SpecRunnerStatement(org.junit.runners.model.TestClass test, Object instance, List<INodeListener> listeners)
          The testing object.
 
Method Summary
protected  IConfiguration configure(IConfiguration cfg)
          Set configuration.
 void evaluate()
           
protected  File getInput(Class<?> clazz)
          Get input file name.
protected  ExpectedMessages getMessages()
          Get expected messages if any.
 File getOutput()
          Get the output file.
protected  File getOutput(Class<?> clazz)
          Get output file name.
 String getOutputName(String name)
          Get the output name adjusted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

test

protected org.junit.runners.model.TestClass test
The test class.


instance

protected Object instance
The test instance.


input

protected File input
The input file.


output

protected File output
The output file.


listeners

protected List<INodeListener> listeners
Listener to activate.

Constructor Detail

SpecRunnerStatement

public SpecRunnerStatement(org.junit.runners.model.TestClass test,
                           Object instance,
                           List<INodeListener> listeners)
The testing object.

Parameters:
test - The test meta-data.
instance - The test instance.
listeners - The listeners to activate.
Method Detail

getInput

protected File getInput(Class<?> clazz)
Get input file name.

Parameters:
clazz - The class.
Returns:
The corresponding file name.

getOutput

protected File getOutput(Class<?> clazz)
Get output file name.

Parameters:
clazz - The class.
Returns:
The corresponding file name.

getOutput

public File getOutput()
Get the output file.

Returns:
The output.

evaluate

public void evaluate()
              throws Throwable
Specified by:
evaluate in class org.junit.runners.model.Statement
Throws:
Throwable

getMessages

protected ExpectedMessages getMessages()
Get expected messages if any.

Returns:
The list of error messages.

configure

protected IConfiguration configure(IConfiguration cfg)
                            throws Throwable
Set configuration.

Parameters:
cfg - The configuration.
Returns:
The configuration itself.
Throws:
Throwable - On configuration errors.

getOutputName

public String getOutputName(String name)
Get the output name adjusted.

Parameters:
name - The original name.
Returns:
The adjusted name. ie. Excel (.xls,.xlsx) test files are transformed to HTML (.html).


Copyright © 2015. All rights reserved.