You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2012/02/15 11:16:27 UTC

svn commit: r1244423 - in /lucene/dev/trunk/lucene: core/src/test/org/apache/lucene/util/junitcompat/ test-framework/src/java/org/apache/lucene/util/

Author: dweiss
Date: Wed Feb 15 10:16:27 2012
New Revision: 1244423

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

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

Copied: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestReproduceMessage.java (from r1244380, lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSorePointsReported.java)
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestReproduceMessage.java?p2=lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestReproduceMessage.java&p1=lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSorePointsReported.java&r1=1244380&r2=1244423&rev=1244423&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSorePointsReported.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestReproduceMessage.java Wed Feb 15 10:16:27 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/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/WithNestedTests.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/WithNestedTests.java?rev=1244423&r1=1244422&r2=1244423&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/WithNestedTests.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/WithNestedTests.java Wed Feb 15 10:16:27 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/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java?rev=1244423&r1=1244422&r2=1244423&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java Wed Feb 15 10:16:27 2012
@@ -534,7 +534,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) {