Search in sources :

Example 6 with IssueNode

use of org.sonarlint.intellij.ui.nodes.IssueNode in project sonarlint-intellij by SonarSource.

the class IssueTreeModelBuilderTest method testNavigation.

@Test
public void testNavigation() {
    Map<VirtualFile, Collection<LiveIssue>> data = new HashMap<>();
    // ordering of files: name
    // ordering of issues: creation date (inverse), getSeverity, setRuleName, startLine
    addFile(data, "file1", 2);
    addFile(data, "file2", 2);
    addFile(data, "file3", 2);
    treeBuilder.updateModel(data, "empty");
    IssueNode first = treeBuilder.getNextIssue((AbstractNode<?>) model.getRoot());
    assertNode(first, "file1", 1);
    IssueNode second = treeBuilder.getNextIssue(first);
    assertNode(second, "file1", 0);
    IssueNode third = treeBuilder.getNextIssue(second);
    assertNode(third, "file2", 1);
    assertThat(treeBuilder.getPreviousIssue(third)).isEqualTo(second);
    assertThat(treeBuilder.getPreviousIssue(second)).isEqualTo(first);
    assertThat(treeBuilder.getPreviousIssue(first)).isNull();
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) HashMap(java.util.HashMap) Collection(java.util.Collection) IssueNode(org.sonarlint.intellij.ui.nodes.IssueNode) Test(org.junit.Test)

Aggregations

IssueNode (org.sonarlint.intellij.ui.nodes.IssueNode)6 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)3 LiveIssue (org.sonarlint.intellij.issue.LiveIssue)3 TreePath (javax.swing.tree.TreePath)2 RangeMarker (com.intellij.openapi.editor.RangeMarker)1 OpenFileDescriptor (com.intellij.openapi.fileEditor.OpenFileDescriptor)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 TreeSet (java.util.TreeSet)1 CheckForNull (javax.annotation.CheckForNull)1 Test (org.junit.Test)1