Nice simplification!

On Fri, Feb 26, 2010 at 9:02 AM, <uschind...@apache.org> wrote:

> Author: uschindler
> Date: Fri Feb 26 14:02:08 2010
> New Revision: 916685
>
> URL: http://svn.apache.org/viewvc?rev=916685&view=rev
> Log:
> LUCENE-2037: Add support for LuceneTestCase.getName() for backwards
> compatibility when reporting failed tests. Also removed The
> InterceptTestCaseEvents class and added as anonymous class (simplified, no
> reflection)
>
> Removed:
>
>  
> lucene/java/trunk/src/test/org/apache/lucene/util/InterceptTestCaseEvents.java
> Modified:
>    lucene/java/trunk/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java
>
> Modified:
> lucene/java/trunk/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java
> URL:
> http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java?rev=916685&r1=916684&r2=916685&view=diff
>
> ==============================================================================
> --- lucene/java/trunk/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java
> (original)
> +++ lucene/java/trunk/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java
> Fri Feb 26 14:02:08 2010
> @@ -25,6 +25,8 @@
>  import org.junit.After;
>  import org.junit.Before;
>  import org.junit.Rule;
> +import org.junit.rules.TestWatchman;
> +import org.junit.runners.model.FrameworkMethod;
>
>  import java.io.PrintStream;
>  import java.util.Arrays;
> @@ -98,14 +100,21 @@
>   // Think of this as start/end/success/failed
>   // events.
>   @Rule
> -  public InterceptTestCaseEvents intercept = new
> InterceptTestCaseEvents(this);
> +  public final TestWatchman intercept = new TestWatchman() {
>
> -  public LuceneTestCaseJ4() {
> -  }
> +    @Override
> +    public void failed(Throwable e, FrameworkMethod method) {
> +      reportAdditionalFailureInfo();
> +      super.failed(e, method);
> +    }
>
> -  public LuceneTestCaseJ4(String name) {
> -    this.name = name;
> -  }
> +    @Override
> +    public void starting(FrameworkMethod method) {
> +      LuceneTestCaseJ4.this.name = method.getName();
> +      super.starting(method);
> +    }
> +
> +  };
>
>   @Before
>   public void setUp() throws Exception {
> @@ -291,6 +300,6 @@
>   // static members
>   private static final Random seedRnd = new Random();
>
> -  private String name = "";
> +  private String name = "<unknown>";
>
>  }
>
>
>

Reply via email to