use of junit.framework.TestCase in project android_frameworks_base by crdroidandroid.
the class TestCaseUtilTest method testGetTestCaseNamesForTestCaseWithSuiteMethod.
public void testGetTestCaseNamesForTestCaseWithSuiteMethod() throws Exception {
TestCase testCase = new OneTestTestCaseWithSuite();
List<String> testCaseNames = TestCaseUtil.getTestCaseNames(testCase, false);
assertEquals(1, testCaseNames.size());
assertTrue(testCaseNames.get(0).endsWith("testOne"));
}
use of junit.framework.TestCase in project hackpad by dropbox.
the class ComplianceTest method createTest.
private static Test createTest(final File testDir, final String name) {
return new TestCase(name) {
@Override
public int countTestCases() {
return 1;
}
@Override
public void runBare() throws Throwable {
final Context cx = Context.enter();
try {
cx.setOptimizationLevel(-1);
final Scriptable scope = cx.initStandardObjects();
ScriptableObject.putProperty(scope, "print", new Print(scope));
createRequire(testDir, cx, scope).requireMain(cx, "program");
} finally {
Context.exit();
}
}
};
}
use of junit.framework.TestCase in project jna by java-native-access.
the class WebStartTest method runTestCaseTest.
private static Throwable runTestCaseTest(String testClass, String method, int port) throws Exception {
TestCase test = (TestCase) Class.forName(testClass).newInstance();
test.setName(method);
TestResult result = new TestResult();
test.run(result);
if (result.failureCount() != 0) {
Enumeration<TestFailure> e = result.failures();
return e.nextElement().thrownException();
} else if (result.errorCount() != 0) {
Enumeration<TestFailure> e = result.errors();
return e.nextElement().thrownException();
}
return null;
}
use of junit.framework.TestCase in project junit4 by junit-team.
the class TextFeedbackTest method testOneTest.
public void testOneTest() {
String expected = expected(new String[] { ".", "Time: 0", "", "OK (1 test)", "" });
TestSuite suite = new TestSuite();
suite.addTest(new TestCase() {
@Override
public void runTest() {
}
});
runner.doRun(suite);
assertEquals(expected, output.toString());
}
use of junit.framework.TestCase in project junit4 by junit-team.
the class TextFeedbackTest method testFailure.
public void testFailure() {
String expected = expected(new String[] { ".F", "Time: 0", "Failures here", "", "FAILURES!!!", "Tests run: 1, Failures: 1, Errors: 0", "" });
ResultPrinter printer = new TestResultPrinter(new PrintStream(output)) {
@Override
public void printFailures(TestResult result) {
getWriter().println("Failures here");
}
};
runner.setPrinter(printer);
TestSuite suite = new TestSuite();
suite.addTest(new TestCase() {
@Override
public void runTest() {
throw new AssertionFailedError();
}
});
runner.doRun(suite);
assertEquals(expected, output.toString());
}
Aggregations