mirror of
https://github.com/apache/lucene.git
synced 2025-02-09 11:35:14 +00:00
LUCENE-3762: follow-up fix of -Dtestname, tests added.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1244423 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6c34d407cd
commit
1fab3f480b
@ -1,5 +1,7 @@
|
|||||||
package org.apache.lucene.util.junitcompat;
|
package org.apache.lucene.util.junitcompat;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
@ -15,10 +17,9 @@ import org.junit.runner.JUnitCore;
|
|||||||
import org.junit.runners.model.Statement;
|
import org.junit.runners.model.Statement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensures proper functions of {@link LuceneTestCase#setUp()}
|
* Test reproduce message is right.
|
||||||
* and {@link LuceneTestCase#tearDown()}.
|
|
||||||
*/
|
*/
|
||||||
public class TestSorePointsReported extends WithNestedTests {
|
public class TestReproduceMessage extends WithNestedTests {
|
||||||
public static SorePoint where;
|
public static SorePoint where;
|
||||||
public static SoreType type;
|
public static SoreType type;
|
||||||
|
|
||||||
@ -97,7 +98,7 @@ public class TestSorePointsReported extends WithNestedTests {
|
|||||||
* ASSUMPTIONS.
|
* ASSUMPTIONS.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public TestSorePointsReported() {
|
public TestReproduceMessage() {
|
||||||
super(true);
|
super(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,6 +174,7 @@ public class TestSorePointsReported extends WithNestedTests {
|
|||||||
type = SoreType.FAILURE;
|
type = SoreType.FAILURE;
|
||||||
where = SorePoint.RULE;
|
where = SorePoint.RULE;
|
||||||
Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
|
Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
|
||||||
|
Assert.assertTrue(Arrays.asList(runAndReturnSyserr().split("\\s")).contains("-Dtestmethod=test"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -180,6 +182,7 @@ public class TestSorePointsReported extends WithNestedTests {
|
|||||||
type = SoreType.FAILURE;
|
type = SoreType.FAILURE;
|
||||||
where = SorePoint.BEFORE;
|
where = SorePoint.BEFORE;
|
||||||
Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
|
Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
|
||||||
|
Assert.assertTrue(Arrays.asList(runAndReturnSyserr().split("\\s")).contains("-Dtestmethod=test"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -187,6 +190,7 @@ public class TestSorePointsReported extends WithNestedTests {
|
|||||||
type = SoreType.FAILURE;
|
type = SoreType.FAILURE;
|
||||||
where = SorePoint.TEST;
|
where = SorePoint.TEST;
|
||||||
Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
|
Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
|
||||||
|
Assert.assertTrue(Arrays.asList(runAndReturnSyserr().split("\\s")).contains("-Dtestmethod=test"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -194,6 +198,7 @@ public class TestSorePointsReported extends WithNestedTests {
|
|||||||
type = SoreType.FAILURE;
|
type = SoreType.FAILURE;
|
||||||
where = SorePoint.AFTER;
|
where = SorePoint.AFTER;
|
||||||
Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
|
Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
|
||||||
|
Assert.assertTrue(Arrays.asList(runAndReturnSyserr().split("\\s")).contains("-Dtestmethod=test"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test @Ignore
|
@Test @Ignore
|
||||||
@ -226,6 +231,7 @@ public class TestSorePointsReported extends WithNestedTests {
|
|||||||
type = SoreType.ERROR;
|
type = SoreType.ERROR;
|
||||||
where = SorePoint.RULE;
|
where = SorePoint.RULE;
|
||||||
Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
|
Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
|
||||||
|
Assert.assertTrue(Arrays.asList(runAndReturnSyserr().split("\\s")).contains("-Dtestmethod=test"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -233,6 +239,7 @@ public class TestSorePointsReported extends WithNestedTests {
|
|||||||
type = SoreType.ERROR;
|
type = SoreType.ERROR;
|
||||||
where = SorePoint.BEFORE;
|
where = SorePoint.BEFORE;
|
||||||
Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
|
Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
|
||||||
|
Assert.assertTrue(Arrays.asList(runAndReturnSyserr().split("\\s")).contains("-Dtestmethod=test"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -240,6 +247,7 @@ public class TestSorePointsReported extends WithNestedTests {
|
|||||||
type = SoreType.ERROR;
|
type = SoreType.ERROR;
|
||||||
where = SorePoint.TEST;
|
where = SorePoint.TEST;
|
||||||
Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
|
Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
|
||||||
|
Assert.assertTrue(Arrays.asList(runAndReturnSyserr().split("\\s")).contains("-Dtestmethod=test"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -247,6 +255,7 @@ public class TestSorePointsReported extends WithNestedTests {
|
|||||||
type = SoreType.ERROR;
|
type = SoreType.ERROR;
|
||||||
where = SorePoint.AFTER;
|
where = SorePoint.AFTER;
|
||||||
Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
|
Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
|
||||||
|
Assert.assertTrue(Arrays.asList(runAndReturnSyserr().split("\\s")).contains("-Dtestmethod=test"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test @Ignore
|
@Test @Ignore
|
||||||
@ -260,7 +269,8 @@ public class TestSorePointsReported extends WithNestedTests {
|
|||||||
JUnitCore.runClasses(Nested.class);
|
JUnitCore.runClasses(Nested.class);
|
||||||
|
|
||||||
String err = getSysErr();
|
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;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -49,8 +49,8 @@ public abstract class WithNestedTests {
|
|||||||
|
|
||||||
protected PrintStream prevSysErr;
|
protected PrintStream prevSysErr;
|
||||||
protected PrintStream prevSysOut;
|
protected PrintStream prevSysOut;
|
||||||
protected ByteArrayOutputStream sysout;
|
private ByteArrayOutputStream sysout;
|
||||||
protected ByteArrayOutputStream syserr;
|
private ByteArrayOutputStream syserr;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public final void before() {
|
public final void before() {
|
||||||
|
@ -534,7 +534,7 @@ public abstract class LuceneTestCase extends Assert {
|
|||||||
|
|
||||||
private void starting(Description description) {
|
private void starting(Description description) {
|
||||||
// set current method name for logging
|
// set current method name for logging
|
||||||
LuceneTestCase.this.name = description.getDisplayName();
|
LuceneTestCase.this.name = description.getMethodName();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ending(Description description) {
|
private void ending(Description description) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user