On 15.02.2012 11:22, [email protected] wrote:
Author: dweiss
Date: Wed Feb 15 10:22:12 2012
New Revision: 1244424

URL: http://svn.apache.org/viewvc?rev=1244424&view=rev
Log:
LUCENE-3762: follow-up fix of -Dtestname, tests added.

Added:
     
lucene/dev/branches/branch_3x/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestReproduceMessage.java
       - copied, changed from r1244381, 
lucene/dev/branches/branch_3x/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSorePointsReported.java
Removed:
     
lucene/dev/branches/branch_3x/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSorePointsReported.java
Modified:
     
lucene/dev/branches/branch_3x/lucene/core/src/test/org/apache/lucene/util/junitcompat/WithNestedTests.java
     
lucene/dev/branches/branch_3x/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java

Copied: 
lucene/dev/branches/branch_3x/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestReproduceMessage.java
 (from r1244381, 
lucene/dev/branches/branch_3x/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSorePointsReported.java)
URL: 
http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestReproduceMessage.java?p2=lucene/dev/branches/branch_3x/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestReproduceMessage.java&p1=lucene/dev/branches/branch_3x/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSorePointsReported.java&r1=1244381&r2=1244424&rev=1244424&view=diff
==============================================================================
--- 
lucene/dev/branches/branch_3x/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSorePointsReported.java
 (original)
+++ 
lucene/dev/branches/branch_3x/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestReproduceMessage.java
 Wed Feb 15 10:22:12 2012
@@ -1,5 +1,7 @@
  package org.apache.lucene.util.junitcompat;

+import java.util.Arrays;
+
  import org.apache.lucene.util.LuceneTestCase;
  import org.junit.After;
  import org.junit.AfterClass;
@@ -15,10 +17,9 @@ import org.junit.runner.JUnitCore;
  import org.junit.runners.model.Statement;

  /**
- * Ensures proper functions of {@link LuceneTestCase#setUp()}
- * and {@link LuceneTestCase#tearDown()}.
+ * Test reproduce message is right.
   */
-public class TestSorePointsReported extends WithNestedTests {
+public class TestReproduceMessage extends WithNestedTests {
    public static SorePoint where;
    public static SoreType  type;

@@ -97,7 +98,7 @@ public class TestSorePointsReported exte
     * ASSUMPTIONS.
     */

-  public TestSorePointsReported() {
+  public TestReproduceMessage() {
      super(true);
    }

@@ -173,6 +174,7 @@ public class TestSorePointsReported exte
      type = SoreType.FAILURE;
      where = SorePoint.RULE;
      Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
+    
Assert.assertTrue(Arrays.asList(runAndReturnSyserr().split("\\s")).contains("-Dtestmethod=test"));
    }

    @Test
@@ -180,6 +182,7 @@ public class TestSorePointsReported exte
      type = SoreType.FAILURE;
      where = SorePoint.BEFORE;
      Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
+    
Assert.assertTrue(Arrays.asList(runAndReturnSyserr().split("\\s")).contains("-Dtestmethod=test"));
    }

    @Test
@@ -187,6 +190,7 @@ public class TestSorePointsReported exte
      type = SoreType.FAILURE;
      where = SorePoint.TEST;
      Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
+    
Assert.assertTrue(Arrays.asList(runAndReturnSyserr().split("\\s")).contains("-Dtestmethod=test"));
    }

    @Test
@@ -194,6 +198,7 @@ public class TestSorePointsReported exte
      type = SoreType.FAILURE;
      where = SorePoint.AFTER;
      Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
+    
Assert.assertTrue(Arrays.asList(runAndReturnSyserr().split("\\s")).contains("-Dtestmethod=test"));
    }

    @Test @Ignore
@@ -226,6 +231,7 @@ public class TestSorePointsReported exte
      type = SoreType.ERROR;
      where = SorePoint.RULE;
      Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
+    
Assert.assertTrue(Arrays.asList(runAndReturnSyserr().split("\\s")).contains("-Dtestmethod=test"));
    }

    @Test
@@ -233,6 +239,7 @@ public class TestSorePointsReported exte
      type = SoreType.ERROR;
      where = SorePoint.BEFORE;
      Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
+    
Assert.assertTrue(Arrays.asList(runAndReturnSyserr().split("\\s")).contains("-Dtestmethod=test"));
    }

    @Test
@@ -240,6 +247,7 @@ public class TestSorePointsReported exte
      type = SoreType.ERROR;
      where = SorePoint.TEST;
      Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
+    
Assert.assertTrue(Arrays.asList(runAndReturnSyserr().split("\\s")).contains("-Dtestmethod=test"));
    }

    @Test
@@ -247,6 +255,7 @@ public class TestSorePointsReported exte
      type = SoreType.ERROR;
      where = SorePoint.AFTER;
      Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
+    
Assert.assertTrue(Arrays.asList(runAndReturnSyserr().split("\\s")).contains("-Dtestmethod=test"));
    }

    @Test @Ignore
@@ -260,7 +269,8 @@ public class TestSorePointsReported exte
      JUnitCore.runClasses(Nested.class);

      String err = getSysErr();
-    // syserr.println("Type: " + type + ", point: " + where + " resulted 
in:\n" + err);
+    //super.prevSysErr.println("Type: " + type + ", point: " + where + " resulted 
in:\n" + err);
+    //super.prevSysErr.println("---");
      return err;
    }
  }

Modified: 
lucene/dev/branches/branch_3x/lucene/core/src/test/org/apache/lucene/util/junitcompat/WithNestedTests.java
URL: 
http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/core/src/test/org/apache/lucene/util/junitcompat/WithNestedTests.java?rev=1244424&r1=1244423&r2=1244424&view=diff
==============================================================================
--- 
lucene/dev/branches/branch_3x/lucene/core/src/test/org/apache/lucene/util/junitcompat/WithNestedTests.java
 (original)
+++ 
lucene/dev/branches/branch_3x/lucene/core/src/test/org/apache/lucene/util/junitcompat/WithNestedTests.java
 Wed Feb 15 10:22:12 2012
@@ -49,8 +49,8 @@ public abstract class WithNestedTests {

    protected PrintStream prevSysErr;
    protected PrintStream prevSysOut;
-  protected ByteArrayOutputStream sysout;
-  protected ByteArrayOutputStream syserr;
+  private ByteArrayOutputStream sysout;
+  private ByteArrayOutputStream syserr;

    @Before
    public final void before() {

Modified: 
lucene/dev/branches/branch_3x/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
URL: 
http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java?rev=1244424&r1=1244423&r2=1244424&view=diff
==============================================================================
--- 
lucene/dev/branches/branch_3x/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
 (original)
+++ 
lucene/dev/branches/branch_3x/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
 Wed Feb 15 10:22:12 2012
@@ -430,7 +430,7 @@ public abstract class LuceneTestCase ext

      private void starting(Description description) {
        // set current method name for logging
-      LuceneTestCase.this.name = description.getDisplayName();
+      LuceneTestCase.this.name = description.getMethodName();
      }

      private void ending(Description description) {




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to