Annotation Interface ElementOf
@Target(TYPE_USE)
@Retention(RUNTIME)
@AppliesTo({byte.class,java.lang.Byte.class,short.class,java.lang.Short.class,int.class,java.lang.Integer.class,long.class,java.lang.Long.class,char.class,java.lang.Character.class,float.class,java.lang.Float.class,double.class,java.lang.Double.class,java.lang.String.class})
public @interface ElementOf
Restricts generated values to a fixed set.
Populate at least one of the type-specific arrays. Only the array that matches the annotated
parameter type is used; all others are ignored. For String and wrapper types, the mutator
may still emit null; add NotNull (the only supported annotation in combination
with @ElementOf) to prevent that.
Example usage:
@FuzzTest
void fuzz(
@ElementOf(integers = {1, 2, 3}) int option,
@ElementOf(strings = {"one", "two"}) String label) {
// option is always 1, 2, or 3; label is always "one" or "two".
}
-
Optional Element Summary
Optional Elements
-
Element Details
-
bytes
byte[] bytes- Default:
{}
-
shorts
short[] shorts- Default:
{}
-
integers
int[] integers- Default:
{}
-
longs
long[] longs- Default:
{}
-
chars
char[] chars- Default:
{}
-
floats
float[] floats- Default:
{}
-
doubles
double[] doubles- Default:
{}
-
strings
String[] strings- Default:
{}
-