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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations