Search in sources :

Example 61 with Failure

use of org.junit.runner.notification.Failure in project geode by apache.

the class RetryRuleLocalWithExceptionTest method failsOnSecondAttempt.

@Test
public void failsOnSecondAttempt() {
    Result result = TestRunner.runTest(FailsOnSecondAttempt.class);
    assertThat(result.wasSuccessful()).isFalse();
    List<Failure> failures = result.getFailures();
    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
    Failure failure = failures.get(0);
    assertThat(failure.getException()).isExactlyInstanceOf(CustomException.class).hasMessage(FailsOnSecondAttempt.message);
    assertThat(FailsOnSecondAttempt.count).isEqualTo(2);
}
Also used : Failure(org.junit.runner.notification.Failure) Result(org.junit.runner.Result) UnitTest(org.apache.geode.test.junit.categories.UnitTest) Test(org.junit.Test)

Example 62 with Failure

use of org.junit.runner.notification.Failure in project geode by apache.

the class RetryRuleGlobalWithExceptionTest method zeroIsIllegal.

@Test
public void zeroIsIllegal() {
    Result result = TestRunner.runTest(ZeroIsIllegal.class);
    assertThat(result.wasSuccessful()).isFalse();
    List<Failure> failures = result.getFailures();
    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
    Failure failure = failures.get(0);
    assertThat(failure.getException()).isExactlyInstanceOf(IllegalArgumentException.class).hasMessage(ZeroIsIllegal.message);
    assertThat(ZeroIsIllegal.count).isEqualTo(0);
}
Also used : Failure(org.junit.runner.notification.Failure) Result(org.junit.runner.Result) UnitTest(org.apache.geode.test.junit.categories.UnitTest) Test(org.junit.Test)

Example 63 with Failure

use of org.junit.runner.notification.Failure in project geode by apache.

the class RetryRuleGlobalWithExceptionTest method failsOnSecondAttempt.

@Test
public void failsOnSecondAttempt() {
    Result result = TestRunner.runTest(FailsOnSecondAttempt.class);
    assertThat(result.wasSuccessful()).isFalse();
    List<Failure> failures = result.getFailures();
    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
    Failure failure = failures.get(0);
    assertThat(failure.getException()).isExactlyInstanceOf(CustomException.class).hasMessage(FailsOnSecondAttempt.message);
    assertThat(FailsOnSecondAttempt.count).isEqualTo(2);
}
Also used : Failure(org.junit.runner.notification.Failure) Result(org.junit.runner.Result) UnitTest(org.apache.geode.test.junit.categories.UnitTest) Test(org.junit.Test)

Example 64 with Failure

use of org.junit.runner.notification.Failure in project geode by apache.

the class RetryRuleGlobalWithExceptionTest method failsWithOne.

@Test
public void failsWithOne() {
    Result result = TestRunner.runTest(FailsWithOne.class);
    assertThat(result.wasSuccessful()).isFalse();
    List<Failure> failures = result.getFailures();
    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
    Failure failure = failures.get(0);
    assertThat(failure.getException()).isExactlyInstanceOf(CustomException.class).hasMessage(FailsWithOne.message);
    assertThat(FailsWithOne.count).isEqualTo(1);
}
Also used : Failure(org.junit.runner.notification.Failure) Result(org.junit.runner.Result) UnitTest(org.apache.geode.test.junit.categories.UnitTest) Test(org.junit.Test)

Example 65 with Failure

use of org.junit.runner.notification.Failure in project geode by apache.

the class RepeatRuleTest method zeroValueShouldThrowIllegalArgumentException.

@Test
public void zeroValueShouldThrowIllegalArgumentException() {
    Result result = TestRunner.runTest(ZeroValueShouldThrowIllegalArgumentException.class);
    assertThat(result.wasSuccessful()).isFalse();
    List<Failure> failures = result.getFailures();
    assertThat(failures.size()).as("Failures: " + failures).isEqualTo(1);
    Failure failure = failures.get(0);
    assertThat(failure.getException()).isExactlyInstanceOf(IllegalArgumentException.class).hasMessage("Repeat value must be a positive integer");
    assertThat(ZeroValueShouldThrowIllegalArgumentException.count).isEqualTo(0);
}
Also used : Failure(org.junit.runner.notification.Failure) Result(org.junit.runner.Result) UnitTest(org.apache.geode.test.junit.categories.UnitTest) Test(org.junit.Test)

Aggregations

Failure (org.junit.runner.notification.Failure)194 Test (org.junit.Test)101 Result (org.junit.runner.Result)91 Description (org.junit.runner.Description)40 IOException (java.io.IOException)32 UnitTest (org.apache.geode.test.junit.categories.UnitTest)27 JUnitCore (org.junit.runner.JUnitCore)24 FileInputStream (java.io.FileInputStream)20 InputStream (java.io.InputStream)20 RunListener (org.junit.runner.notification.RunListener)19 ArrayList (java.util.ArrayList)11 ByteArrayInputStream (java.io.ByteArrayInputStream)9 ComparisonFailure (org.junit.ComparisonFailure)9 JUnit4TestListener (com.intellij.junit4.JUnit4TestListener)7 RunNotifier (org.junit.runner.notification.RunNotifier)7 ResourceImpl (ddf.catalog.resource.impl.ResourceImpl)6 Request (org.junit.runner.Request)6 BinaryContentImpl (ddf.catalog.data.impl.BinaryContentImpl)5 Before (org.junit.Before)5 Runner (org.junit.runner.Runner)5