Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Modified CustomRunner to log when test classes and their methods begi…

…n processing, allowing other logged messages to be associated with the corresponding test or @BeforeClass method
  • Loading branch information...
commit db53c72a8528e8237f31bb349abdd756371e8732 1 parent 7f52b47
John Verhaeg authored
View
18 hibernate-testing/src/main/java/org/hibernate/testing/junit4/CustomRunner.java
@@ -25,15 +25,16 @@
import java.lang.annotation.Annotation;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
-import java.util.LinkedList;
import java.util.List;
import org.jboss.logging.Logger;
+import org.junit.BeforeClass;
import org.junit.Ignore;
+import org.junit.Test;
import org.junit.runner.manipulation.NoTestsRemainException;
+import org.junit.runner.notification.RunNotifier;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.InitializationError;
@@ -121,9 +122,22 @@ protected Statement withAfterClasses(Statement statement) {
);
}
+ /**
+ * {@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
protected Statement methodBlock(FrameworkMethod method) {
+ log.info( Test.class.getSimpleName() + ": " + method.getName() );
+
final Statement originalMethodBlock = super.methodBlock( method );
final ExtendedFrameworkMethod extendedFrameworkMethod = (ExtendedFrameworkMethod) method;
return new FailureExpectedHandler( originalMethodBlock, testClassMetadata, extendedFrameworkMethod, testInstance );
Please sign in to comment.
Something went wrong with that request. Please try again.