Package rife.bld.extension.testing
Annotation Interface RandomRange
JUnit annotation for generating random integer values within a specified range.
This annotation can be applied to test method parameters of type int
to automatically
inject random values during test execution. It can also be applied at the method level to
configure default settings for all int parameters in that method.
Example usage:
@ExtendWith(RandomRangeResolver.class) public class MyTest { // Parameter-level annotation @Test public void testMethod(@RandomRange(min = 1, max = 10) int randomValue) { // randomValue will be a random integer between 1 and 10 (inclusive) } // Method-level annotation for single parameter @Test @RandomRange(min = 5, max = 15) public void testWithMethodLevel(int randomValue) { // randomValue will be a random integer between 5 and 15 (inclusive) } // Method-level annotation applies to all int parameters @Test @RandomRange(min = 1, max = 100) public void testMultiple(int first, int second) { // Both first and second will be random integers between 1 and 100 (inclusive) } // Parameter-level annotation overrides method-level @Test @RandomRange(min = 1, max = 10) public void testMixed(int defaultRange, @RandomRange(min = 50, max = 60) int customRange) { // defaultRange: 1-10, customRange: 50-60 } }
- Since:
- 1.0
- Author:
- Erik C. Thauvin
- See Also:
-
Optional Element Summary
Optional Elements
-
Element Details
-
max
int maxThe maximum value (inclusive) for the random number generation.- Returns:
- the maximum value, defaults to 100
- Default:
- 100
-
min
int minThe minimum value (inclusive) for the random number generation.- Returns:
- the minimum value, defaults to 0
- Default:
- 0
-