HHH-8127 OutOfMemoryError when running tests

This commit is contained in:
Strong Liu 2013-04-22 18:41:02 +08:00
parent 3343e6d6c3
commit 11464ea097
1 changed files with 18 additions and 1 deletions

View File

@ -100,7 +100,24 @@ public class CustomRunner extends BlockJUnit4ClassRunner {
return isAllTestsIgnored;
}
@Override
@Override
public void run(RunNotifier notifier) {
super.run( notifier );
cleanup();
}
private void cleanup() {
if ( computedTestMethods != null && !computedTestMethods.isEmpty() ) {
computedTestMethods.clear();
computedTestMethods = null;
}
testInstance = null;
testClassMetadata = null;
}
@Override
protected Statement withBeforeClasses(Statement statement) {
if ( isAllTestsIgnored() ) {
return super.withBeforeClasses( statement );