I've got a JMH benchmark with several @Param
fields. The issue is that some param combinations are not valid - they are nonsensical.
Is there a way to mark a particular combination of params as 'not valid' during setup - so the benchmark is not run, but it is not marked as failure either? Similar to AssumptionViolatedException
for JUnit?
ie I want to do the following:
@State(Scope.Benchmark)
public class JMH {
@Param({"s1", "s2"})
String param1;
@Param({"s3", "s4"})
String param2;
@Setup
public void setup() {
if (param1.equals("s1") && param2.equals("s4")) {
// this combination is not valid for the use case
// this benchmark is for
throw new DoNotBenchmarkException(); // just skip this one
}
// carry on and setup the benchmark...
}
}