Skip to content
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...
1 parent 7f52b47 commit db53c72a8528e8237f31bb349abdd756371e8732 John Verhaeg committed
Showing with 16 additions and 2 deletions.
  1. +16 −2 hibernate-testing/src/main/java/org/hibernate/testing/junit4/CustomRunner.java
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 );

0 comments on commit db53c72

Please sign in to comment.
Something went wrong with that request. Please try again.