use of com.carrotsearch.randomizedtesting.annotations.Name in project randomizedtesting by randomizedtesting.
the class RandomizedRunner method createDefaultArgumentFormatting.
/**
* Default formatting string for constructor arguments.
*/
private static String createDefaultArgumentFormatting(Constructor<?> constructor) {
StringBuilder b = new StringBuilder();
final int argCount = constructor.getParameterTypes().length;
Annotation[][] anns = constructor.getParameterAnnotations();
for (int i = 0; i < argCount; i++) {
String argName = null;
for (Annotation ann : anns[i]) {
if (ann != null && ann.annotationType().equals(Name.class)) {
argName = ((Name) ann).value();
break;
}
}
if (argName == null) {
argName = "p" + i;
}
b.append(i > 0 ? " " : "").append(argName).append("=%s");
}
return b.toString();
}
Aggregations