When number of arguments to a method exceeds 7, checkstyle error (i.e., More than 7 parameters (found 8). [ParameterNumber]) would be thrown. Hence, for below method also it is throwing. Generally, checkstyle error can be avoided by using String array or Hashmap.
But, how to avoid here being the method arguments having @Optional annotation?
@Parameters({ "test1", "test2", "test3", "test4", "test5", "test6", "test7", "test8" })
@BeforeTest
public void beforeTest(@Optional("value1") String test1, @Optional("value2") String test2, @Optional("value3") String test3, @Optional("value4") String test4, @Optional("value5") String test5, @Optional("value6") String test6, @Optional("value7") String test7, @Optional("value8") String test8) {
....
}
One way is to increase the parameter limit in checkstyle.xml.
But, looking for if there is any better solution.