Skip to content
This repository has been archived by the owner on Oct 13, 2020. It is now read-only.

Corollaries.assumptionSort skips entries #10

Open
MadMartian opened this issue Jan 8, 2013 · 0 comments
Open

Corollaries.assumptionSort skips entries #10

MadMartian opened this issue Jan 8, 2013 · 0 comments

Comments

@MadMartian
Copy link

I found that the assumptionSort method in Corollaries class skips over some methods resulting in a broken dependency tree for tests.

Regarding the source code snippet for this method:
private void assumptionSort(List methods) {
int size = methods.size();
for (int i = 0; i < size; i++) {
FrameworkMethod m = methods.get(i);
Assumes assumes = m.getAnnotation(Assumes.class);
if (assumes != null) {
Set assumptions = new HashSet(Arrays.asList(assumes.value()));
for (int j = size - 1; j > i; j--) {
if (assumptions.contains(methods.get(j).getName())) {
methods.add(j, methods.remove(i));
break;
}
}
}
}
}

Applying this change should fix it:

-methods.add(j, methods.remove(i));
+methods.add(j, methods.remove(i--));

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant