I have extended the FrameworkMethod class like this:
private class RepeatedFrameworkMethod extends FrameworkMethod {
private int number;
public RepeatedFrameworkMethod(Method method, int i) {
super(method);
this.number = i;
}
@Override
public String getName() {
System.out.println(number);
return String.format("%s[%d]", super.getName(), number);
}
}
When iterating the method, the name remains the same (i.e, number is set once to 0).
for (FrameworkMethod testMethod : testMethods) {
Repeat repeat = testMethod.getAnnotation(Repeat.class);
if (repeat == null) {
children.add(testMethod);
}
else {
for (int i = 0; i < repeat.times(); i++) {
children.add(new RepeatedFrameworkMethod(testMethod.getMethod(), i));
}
}
}
This is what I get in Eclipse.
Always 0. It used to work with Junit 4.11.
any Idea? Thanks.
Aucun commentaire:
Enregistrer un commentaire