Search in sources :

Example 86 with Result

use of org.junit.runner.Result in project junit4 by junit-team.

the class ParallelMethodTest method testsRunInParallel.

@Test
public void testsRunInParallel() {
    Result result = JUnitCore.runClasses(ParallelComputer.methods(), Example.class);
    assertTrue(result.wasSuccessful());
    assertNotNull(fOne);
    assertNotNull(fTwo);
    assertThat(fOne, is(not(fTwo)));
}
Also used : Result(org.junit.runner.Result) Test(org.junit.Test)

Example 87 with Result

use of org.junit.runner.Result in project junit4 by junit-team.

the class TestRuleTest method onFailure.

@Test
public void onFailure() {
    log = "";
    Result result = JUnitCore.runClasses(OnFailureTest.class);
    assertEquals(String.format("nothing(%s) AssertionError", OnFailureTest.class.getName()), log);
    assertEquals(1, result.getFailureCount());
}
Also used : Result(org.junit.runner.Result) PrintableResult.testResult(org.junit.experimental.results.PrintableResult.testResult) Test(org.junit.Test)

Example 88 with Result

use of org.junit.runner.Result in project junit4 by junit-team.

the class TestRuleTest method methodIgnoreNonRules.

@Test
public void methodIgnoreNonRules() {
    Result result = JUnitCore.runClasses(MethodNoRulesTest.class);
    assertEquals(0, result.getFailureCount());
}
Also used : Result(org.junit.runner.Result) PrintableResult.testResult(org.junit.experimental.results.PrintableResult.testResult) Test(org.junit.Test)

Example 89 with Result

use of org.junit.runner.Result in project junit4 by junit-team.

the class TimeoutRuleTest method nullTimeUnit.

@Test
public void nullTimeUnit() {
    Result result = JUnitCore.runClasses(HasNullTimeUnit.class);
    assertEquals(1, result.getFailureCount());
    Failure failure = result.getFailures().get(0);
    assertThat(failure.getException().getMessage(), containsString("Invalid parameters for Timeout"));
    Throwable cause = failure.getException().getCause();
    assertThat(cause.getMessage(), containsString("TimeUnit cannot be null"));
}
Also used : Failure(org.junit.runner.notification.Failure) Result(org.junit.runner.Result) Test(org.junit.Test)

Example 90 with Result

use of org.junit.runner.Result in project junit4 by junit-team.

the class StopwatchTest method runtimeDuringTestShouldReturnTimeSinceStart.

@Test
public void runtimeDuringTestShouldReturnTimeSinceStart() {
    Result result = runTest(DurationDuringTestTest.class);
    assertTrue(result.wasSuccessful());
}
Also used : Result(org.junit.runner.Result) Test(org.junit.Test)

Aggregations

Result (org.junit.runner.Result)343 Test (org.junit.Test)267 JUnitCore (org.junit.runner.JUnitCore)104 Failure (org.junit.runner.notification.Failure)93 PrintableResult.testResult (org.junit.experimental.results.PrintableResult.testResult)61 UnitTest (org.apache.geode.test.junit.categories.UnitTest)56 Description (org.junit.runner.Description)28 Request (org.junit.runner.Request)23 TestResult (junit.framework.TestResult)21 RunListener (org.junit.runner.notification.RunListener)18 IOException (java.io.IOException)12 SettableCurrentRunningTest (com.google.testing.junit.runner.internal.junit4.SettableCurrentRunningTest)11 CurrentRunningTest (com.google.testing.junit.runner.util.CurrentRunningTest)11 JUnit4TestListener (com.intellij.junit4.JUnit4TestListener)9 ArrayList (java.util.ArrayList)8 Runner (org.junit.runner.Runner)7 ComparisonFailure (org.junit.ComparisonFailure)6 CategoryFilter (org.junit.experimental.categories.Categories.CategoryFilter)5 TextListener (org.junit.internal.TextListener)5 ShardingEnvironment (com.google.testing.junit.runner.sharding.ShardingEnvironment)4