blob: fc3651ad9475467af73ca0db7e9105677083ae67 [file] [log] [blame]
package junit.tests.runner;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import junit.framework.TestCase;
import junit.textui.ResultPrinter;
import junit.textui.TestRunner;
/**
* Test invoking a single test method of a TestCase.
*/
public class TextRunnerSingleMethodTest extends TestCase {
static boolean fgWasInvoked;
public static class InvocationTest extends TestCase {
public void testWasInvoked() {
TextRunnerSingleMethodTest.fgWasInvoked = true;
}
public void testNotInvoked() {
fail("Shouldn't get here.");
}
}
public void testSingle() throws Exception {
TestRunner t = new TestRunner();
t.setPrinter(new ResultPrinter(new PrintStream(new ByteArrayOutputStream())));
String[] args = {
"-m", "junit.tests.runner.TextRunnerSingleMethodTest$InvocationTest.testWasInvoked"
};
fgWasInvoked = false;
t.start(args);
assertTrue(fgWasInvoked);
}
}