Modified CustomRunner to log when test classes and their methods begin processing, allowing other logged messages to be associated with the corresponding test or @BeforeClass method
This commit is contained in:
parent
7f52b476c9
commit
db53c72a85
|
@ -25,15 +25,16 @@ package org.hibernate.testing.junit4;
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
|
import org.junit.Test;
|
||||||
import org.junit.runner.manipulation.NoTestsRemainException;
|
import org.junit.runner.manipulation.NoTestsRemainException;
|
||||||
|
import org.junit.runner.notification.RunNotifier;
|
||||||
import org.junit.runners.BlockJUnit4ClassRunner;
|
import org.junit.runners.BlockJUnit4ClassRunner;
|
||||||
import org.junit.runners.model.FrameworkMethod;
|
import org.junit.runners.model.FrameworkMethod;
|
||||||
import org.junit.runners.model.InitializationError;
|
import org.junit.runners.model.InitializationError;
|
||||||
|
@ -121,9 +122,22 @@ public class CustomRunner extends BlockJUnit4ClassRunner {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*
|
||||||
|
* @see org.junit.runners.ParentRunner#classBlock(org.junit.runner.notification.RunNotifier)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected Statement classBlock( RunNotifier notifier ) {
|
||||||
|
log.info( BeforeClass.class.getSimpleName() + ": " + getName() );
|
||||||
|
|
||||||
|
return super.classBlock( notifier );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Statement methodBlock(FrameworkMethod method) {
|
protected Statement methodBlock(FrameworkMethod method) {
|
||||||
|
log.info( Test.class.getSimpleName() + ": " + method.getName() );
|
||||||
|
|
||||||
final Statement originalMethodBlock = super.methodBlock( method );
|
final Statement originalMethodBlock = super.methodBlock( method );
|
||||||
final ExtendedFrameworkMethod extendedFrameworkMethod = (ExtendedFrameworkMethod) method;
|
final ExtendedFrameworkMethod extendedFrameworkMethod = (ExtendedFrameworkMethod) method;
|
||||||
return new FailureExpectedHandler( originalMethodBlock, testClassMetadata, extendedFrameworkMethod, testInstance );
|
return new FailureExpectedHandler( originalMethodBlock, testClassMetadata, extendedFrameworkMethod, testInstance );
|
||||||
|
|
Loading…
Reference in New Issue