patterntesting.runtime.junit.internal
Class ProfiledStatement

Package class diagram package ProfiledStatement
java.lang.Object
  extended by org.junit.runners.model.Statement
      extended by patterntesting.runtime.junit.internal.ProfiledStatement

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

The ProfiledStatement measures also the time the different setUp() and tearDown() methods need. In contradiction to the original JUnit statement this statement is not only a wrapper around the test method but contains also the setUp and tearDown methods. And it is able to handle JUnit4 and JUnit3 methods.

Since:
1.0 (29.03.2010)
Author:
oliver

Constructor Summary
ProfiledStatement(org.junit.runners.model.TestClass testClass, org.junit.runners.model.FrameworkMethod frameworkMethod)
          The default constructor for this class if the call of the frameworkMethod is ok.
 
Method Summary
 void endTimer()
          The timer should end after the last tearDown() method was called.
 void evaluate()
          Invokes the test method.
protected  String getMethodName()
          May be needed by some subclasses.
static boolean isTestCaseClass(org.junit.runners.model.TestClass testClass)
           
 void startAftersTimer()
          Here we start the timer when the first tearDown() method was called.
 void startTestTimer()
          Here we start the timer when the test method was called.
 void startTimer()
          Here we start the timer when the first setUp() method was called.
 String toString()
          Returns the name of the method with the measured times.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProfiledStatement

public ProfiledStatement(org.junit.runners.model.TestClass testClass,
                         org.junit.runners.model.FrameworkMethod frameworkMethod)
The default constructor for this class if the call of the frameworkMethod is ok.

Parameters:
testClass - the test class
frameworkMethod - the FrameworkMethod
Method Detail

getMethodName

protected final String getMethodName()
May be needed by some subclasses.

Returns:
the method name

evaluate

public void evaluate()
              throws Throwable
Invokes the test method.

Specified by:
evaluate in class org.junit.runners.model.Statement
Throws:
Throwable - the throwable
See Also:
Statement.evaluate()

startTimer

public final void startTimer()
Here we start the timer when the first setUp() method was called.


startTestTimer

public final void startTestTimer()
Here we start the timer when the test method was called.


startAftersTimer

public final void startAftersTimer()
Here we start the timer when the first tearDown() method was called.


endTimer

public final void endTimer()
The timer should end after the last tearDown() method was called.


toString

public String toString()
Returns the name of the method with the measured times.

Overrides:
toString in class Object
Returns:
the framework method with the measured times
See Also:
Object.toString()

isTestCaseClass

public static boolean isTestCaseClass(org.junit.runners.model.TestClass testClass)
Parameters:
testClass - the test class
Returns:
true if testClass is derived from TestCase


Copyright © 2002–2014 PatternTesting Team. All rights reserved.