com.atlassian.jira.junit.rules
Class ClearStatics

java.lang.Object
  extended by org.junit.rules.TestWatcher
      extended by com.atlassian.jira.junit.rules.ClearStatics
All Implemented Interfaces:
org.junit.rules.TestRule

public class ClearStatics
extends org.junit.rules.TestWatcher

Clear static variables in JIRA both before and after the test runs to improve test separation.

This clears out things like the component accessor's worker, the authentication context, thread local searcher data, database configuration, and webwork configuration that may pollute this or some other test.

Just add this to your test:

     @Rule public ClearStatics clearStatics = new ClearStatics();
 

Since:
6.0

Constructor Summary
ClearStatics()
           
 
Method Summary
protected  void finished(org.junit.runner.Description description)
           
protected  void starting(org.junit.runner.Description description)
           
 
Methods inherited from class org.junit.rules.TestWatcher
apply, failed, succeeded
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClearStatics

public ClearStatics()
Method Detail

finished

protected void finished(org.junit.runner.Description description)
Overrides:
finished in class org.junit.rules.TestWatcher

starting

protected void starting(org.junit.runner.Description description)
Overrides:
starting in class org.junit.rules.TestWatcher


Copyright © 2002-2014 Atlassian. All Rights Reserved.