Skip to content

Commit

Permalink
assert order of quickfix/refactor/source actions
Browse files Browse the repository at this point in the history
Signed-off-by: Yan Zhang <[email protected]>
  • Loading branch information
Eskibear committed Nov 19, 2019
1 parent aaf18ea commit 11e02d2
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;

import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.ICompilationUnit;
Expand Down Expand Up @@ -231,6 +232,10 @@ public void testCodeAction_allKindsOfActions() throws Exception {
assertTrue("No refactor actions were found", hasRefactor);
boolean hasSource = codeActions.stream().anyMatch(codeAction -> codeAction.getRight().getKind().startsWith(CodeActionKind.Source));
assertTrue("No source actions were found", hasSource);

List<String> a = codeActions.stream().map(codeAction -> codeAction.getRight().getKind()).collect(Collectors.toList());
assertTrue("quickfix actions should be ahead of refactor actions", a.lastIndexOf(CodeActionKind.QuickFix) < a.indexOf(CodeActionKind.Refactor));
assertTrue("refactor actions should be ahead of source actions", a.lastIndexOf(CodeActionKind.Refactor) < a.indexOf(CodeActionKind.Source));
}

@Test
Expand Down

0 comments on commit 11e02d2

Please sign in to comment.