Merge pull request #15384 from Michaelin007/jplatform

Failure Threshold Support for @RepeatedTest in Junit
This commit is contained in:
Maiklins 2023-12-16 10:23:40 +01:00 committed by GitHub
commit 8ea98f014f
1 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,16 @@
package com.baeldung.junit5.failurethreshold;
import org.junit.jupiter.api.RepeatedTest;
import java.util.Random;
import static org.junit.jupiter.api.Assertions.assertTrue;
class FailureThresholdUnitTest {
Random random = new Random();
@RepeatedTest(value = 10, failureThreshold = 2)
void givenRandomNumberGenerator_whenGeneratingRandomNumber_thenNumberShouldBeWithinRange() {
int number = random.nextInt(10);
assertTrue(number <= 9);
}
}