org.unitils.io.annotation.handler
Class TempFileAnnotationHandler

java.lang.Object
  extended by org.unitils.core.TestListener
      extended by org.unitils.io.annotation.handler.TempFileAnnotationHandler

public class TempFileAnnotationHandler
extends TestListener

Implements the behavior of the TempFile annotation.
See annotation javadoc for more info.

Since:
3.3
Author:
Jeroen Horemans, Tim Ducheyne, Thomas De Rycke

Field Summary
protected  Boolean cleanupAfterTest
           
protected  TempService tempService
           
 
Constructor Summary
TempFileAnnotationHandler(TempService tempService, boolean cleanupAfterTest)
           
 
Method Summary
 void afterTestMethod(Object testObject, Method testMethod, Throwable t)
          Invoked after the test run but before the test tear down (e.g.
 void beforeTestSetUp(Object testObject, Method testMethod)
          Invoked before the test setup (eg @Before) is run.
protected  void createTempFileForField(Object testObject, Method testMethod, Field field)
           
protected  void deleteTempFileForField(Object testObject, Field field)
           
 
Methods inherited from class org.unitils.core.TestListener
afterCreateTestObject, afterTestTearDown, beforeTestClass, beforeTestMethod
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cleanupAfterTest

protected Boolean cleanupAfterTest

tempService

protected TempService tempService
Constructor Detail

TempFileAnnotationHandler

public TempFileAnnotationHandler(TempService tempService,
                                 boolean cleanupAfterTest)
Method Detail

beforeTestSetUp

public void beforeTestSetUp(Object testObject,
                            Method testMethod)
Description copied from class: TestListener
Invoked before the test setup (eg @Before) is run. This can be overridden to for example initialize the test-fixture.

Overrides:
beforeTestSetUp in class TestListener
Parameters:
testObject - The test instance, not null
testMethod - The test method, not null

afterTestMethod

public void afterTestMethod(Object testObject,
                            Method testMethod,
                            Throwable t)
Description copied from class: TestListener
Invoked after the test run but before the test tear down (e.g. @After). This can be overridden to for example add assertions for testing the result of the test. It the before method or the test raised an exception, this exception will be passed to the method.

Overrides:
afterTestMethod in class TestListener
Parameters:
testObject - The test instance, not null
testMethod - The test method, not null
t - The throwable thrown during the test or beforeTestMethod, null if none was thrown

createTempFileForField

protected void createTempFileForField(Object testObject,
                                      Method testMethod,
                                      Field field)

deleteTempFileForField

protected void deleteTempFileForField(Object testObject,
                                      Field field)


Copyright © 2011. All Rights Reserved.