use of junit.framework.Test in project android_frameworks_base by ParanoidAndroid.
the class TestCaseUtil method getTestAtIndex.
public static Test getTestAtIndex(TestSuite testSuite, int position) {
int index = 0;
Enumeration enumeration = testSuite.tests();
while (enumeration.hasMoreElements()) {
Test test = (Test) enumeration.nextElement();
if (index == position) {
return test;
}
index++;
}
return null;
}
use of junit.framework.Test in project junit4 by junit-team.
the class SuiteTest method testNotExistingTestCase.
public void testNotExistingTestCase() {
Test t = new SuiteTest("notExistingMethod");
t.run(fResult);
assertTrue(fResult.runCount() == 1);
assertTrue(fResult.failureCount() == 1);
assertTrue(fResult.errorCount() == 0);
}
use of junit.framework.Test in project junit4 by junit-team.
the class SuiteTest method testNoTestCaseClass.
public void testNoTestCaseClass() {
Test t = new TestSuite(NoTestCaseClass.class);
t.run(fResult);
// warning test
assertEquals(1, fResult.runCount());
assertTrue(!fResult.wasSuccessful());
}
use of junit.framework.Test in project junit4 by junit-team.
the class TestCaseTest method testExceptionRunningAndTearDown.
public void testExceptionRunningAndTearDown() {
// With 1.4, we should
// wrap the exception thrown while running with the exception thrown
// while tearing down
Test t = new TornDown() {
@Override
public void tearDown() {
throw new Error("tearingDown");
}
};
TestResult result = new TestResult();
t.run(result);
TestFailure failure = result.errors().nextElement();
assertEquals("running", failure.thrownException().getMessage());
}
use of junit.framework.Test in project junit4 by junit-team.
the class TestCaseTest method testNoArgTestCasePasses.
public void testNoArgTestCasePasses() {
Test t = new TestSuite(NoArgTestCaseTest.class);
TestResult result = new TestResult();
t.run(result);
assertTrue(result.runCount() == 1);
assertTrue(result.failureCount() == 0);
assertTrue(result.errorCount() == 0);
}
Aggregations