org.specrunner.junit
Class JUnitUtils

java.lang.Object
  extended by org.specrunner.junit.JUnitUtils

public final class JUnitUtils
extends Object

JUnit useful functions.

Author:
Thiago Santos

Field Summary
static String PATH
          Output path.
 
Method Summary
static File getFile(Class<?> clazz)
          Get the HTML file corresponding to the Java.
static File getOutput(Class<?> clazz, File input)
          Get the output file.
static String getOutputName(String name)
          Get the output name adjusted.
protected static IScenarioListener getScenarioCleaner(Class<?> javaClass)
          Get scenario cleaner.
static IScenarioListener[] getScenarioListener(Class<?> type)
          Given a class return instances for scenario listeners.
static List<org.junit.runners.model.FrameworkMethod> prepareScenarios(IRunnerScenario runner)
          Prepare scenario runners.
static List<Class<? extends IScenarioListener>> scanAnnotation(Class<?> type)
          Get full list of scenario listeners in annotations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATH

public static final String PATH
Output path.

Method Detail

getFile

public static File getFile(Class<?> clazz)
Get the HTML file corresponding to the Java.

Parameters:
clazz - The test class.
Returns:
The input HTML file.

getOutput

public static File getOutput(Class<?> clazz,
                             File input)
Get the output file.

Parameters:
clazz - The test class.
input - The input file.
Returns:
The output file.

getOutputName

public static 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).

getScenarioListener

public static IScenarioListener[] getScenarioListener(Class<?> type)
Given a class return instances for scenario listeners.

Parameters:
type - The base object type.
Returns:
An array of listener instances.

scanAnnotation

public static List<Class<? extends IScenarioListener>> scanAnnotation(Class<?> type)
Get full list of scenario listeners in annotations.

Parameters:
type - A type.
Returns:
A list of scenario listeners classes for the given type, in order, from top most class to bottom class.

prepareScenarios

public static List<org.junit.runners.model.FrameworkMethod> prepareScenarios(IRunnerScenario runner)
Prepare scenario runners.

Parameters:
runner - Runners.
Returns:
A list of methods.

getScenarioCleaner

protected static IScenarioListener getScenarioCleaner(Class<?> javaClass)
Get scenario cleaner.

Parameters:
javaClass - Test class.
Returns:
A cleaner.


Copyright © 2015. All rights reserved.