public List<StepCandidate> listCandidates() {
List<StepCandidate> candidates = new ArrayList<StepCandidate>();
for (Method method : allMethods()) {
if (method.isAnnotationPresent(Given.class)) {
Given annotation = method.getAnnotation(Given.class);
String value = annotation.value();
int priority = annotation.priority();
addCandidatesFromVariants(candidates, method, GIVEN, value, priority);
addCandidatesFromAliases(candidates, method, GIVEN, priority);
}
if (method.isAnnotationPresent(When.class)) {
When annotation = method.getAnnotation(When.class);
String value = annotation.value();
int priority = annotation.priority();
addCandidatesFromVariants(candidates, method, WHEN, value, priority);
addCandidatesFromAliases(candidates, method, WHEN, priority);
}
if (method.isAnnotationPresent(Then.class)) {
Then annotation = method.getAnnotation(Then.class);
String value = annotation.value();
int priority = annotation.priority();
addCandidatesFromVariants(candidates, method, THEN, value, priority);
addCandidatesFromAliases(candidates, method, THEN, priority);
}
}
return candidates;