<dependency>
<groupId>com.carrotsearch</groupId>
<artifactId>randomizedtesting-shaded</artifactId>
<version>3.2.0-RC2</version>
<scope>test</scope>
</dependency>
groovy
testImplementation 'com.carrotsearch:randomizedtesting-shaded:3.2.0-RC2'
import org.junit.runner.RunWith;
import com.carrotsearch.randomizedtesting.RandomizedRunner;
@RunWith(RandomizedRunner.class)
public class RandomizedTest {
}
import org.junit.Assert;
import org.junit.Test;
public class RandomizedTest {
@Test
public void testRandomInput() {
int a = RandomizedRunner.getRandom().nextInt();
int b = RandomizedRunner.getRandom().nextInt();
int sum = a + b;
Assert.assertTrue(sum >= a && sum >= b);
}
}
mvn test
gradle test