use of org.junit.runner.JUnitCore in project junit4 by junit-team.
the class AnnotationTest method testTwoTests.
public void testTwoTests() throws Exception {
count = 0;
tests = new HashSet<Object>();
JUnitCore runner = new JUnitCore();
runner.run(TwoTests.class);
assertEquals(2, count);
assertEquals(2, tests.size());
}
use of org.junit.runner.JUnitCore in project junit4 by junit-team.
the class AnnotationTest method testTeardownFailure.
public void testTeardownFailure() throws Exception {
JUnitCore core = new JUnitCore();
Result runner = core.run(TeardownFailureTest.class);
assertEquals(1, runner.getRunCount());
assertEquals(1, runner.getFailureCount());
assertEquals(Error.class, runner.getFailures().get(0).getException().getClass());
}
use of org.junit.runner.JUnitCore in project junit4 by junit-team.
the class AnnotationTest method testErrorInBeforeClass.
public void testErrorInBeforeClass() throws Exception {
run = false;
JUnitCore core = new JUnitCore();
Result result = core.run(ErrorInBeforeClass.class);
assertFalse(run);
assertEquals(1, result.getFailureCount());
Description description = result.getFailures().get(0).getDescription();
assertEquals(ErrorInBeforeClass.class.getName(), description.getDisplayName());
}
use of org.junit.runner.JUnitCore in project junit4 by junit-team.
the class AnnotationTest method testExceptionNotThrown.
public void testExceptionNotThrown() throws Exception {
JUnitCore core = new JUnitCore();
Result result = core.run(NoExceptionTest.class);
assertEquals(1, result.getFailureCount());
assertEquals("Expected exception: java.lang.Error", result.getFailures().get(0).getMessage());
}
use of org.junit.runner.JUnitCore in project junit4 by junit-team.
the class AnnotationTest method testSetup.
public void testSetup() throws Exception {
JUnitCore runner = new JUnitCore();
runner.run(SetupTest.class);
assertTrue(run);
}
Aggregations