uk.org.retep.test.BaseTest Maven / Gradle / Ivy
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package uk.org.retep.test;
import org.apache.log4j.xml.DOMConfigurator;
import org.junit.After;
import org.junit.Before;
import uk.org.retep.logging.LogSupport;
/**
*
* @author peter
*/
public class BaseTest
extends LogSupport
{
static
{
DOMConfigurator.configure( BaseTest.class.getResource( "log4j.xml" ) );
}
@Before
public final void setUp()
throws Throwable
{
getLog().info( "Setting up test" );
try
{
preSetUp();
globalSetUp();
postSetUp();
getLog().info( "Test setup\n" );
}
catch( Throwable t )
{
getLog().fatal( "Test setup failure", t );
throw t;
}
}
protected void preSetUp()
throws Exception
{
}
protected void globalSetUp()
throws Exception
{
}
protected void postSetUp()
throws Exception
{
}
@After
public final void tearDown()
throws Throwable
{
getLog().info( "Tearing down test\n" );
try
{
preTearDown();
globalTearDown();
postTearDown();
getLog().info( "Test torn down\n" );
}
catch( Throwable t )
{
getLog().fatal( "Test tearDown failure", t );
throw t;
}
}
protected void preTearDown()
throws Exception
{
}
protected void globalTearDown()
throws Exception
{
}
protected void postTearDown()
throws Exception
{
}
}