use of org.sonarlint.intellij.issue.LiveIssue in project sonarlint-intellij by SonarSource.
the class SonarLintCheckinHandlerTest method testIssues.
@Test
public void testIssues() {
future.complete(null);
LiveIssue issue = mock(LiveIssue.class);
when(issueManager.getForFile(file)).thenReturn(Collections.singleton(issue));
handler = new SonarLintCheckinHandler(globalSettings, project, checkinProjectPanel);
CheckinHandler.ReturnResult result = handler.beforeCheckin(null, null);
assertThat(result).isEqualTo(CheckinHandler.ReturnResult.CANCEL);
verify(analysisResultIssues).set(anyMap(), eq("SCM changed files"));
verify(submitter).submitFilesModal(eq(Collections.singleton(file)), eq(TriggerType.CHECK_IN), any(AnalysisCallback.class));
}
use of org.sonarlint.intellij.issue.LiveIssue in project sonarlint-intellij by SonarSource.
the class IssueNodeTest method testHoursAndSeverity.
@Test
public void testHoursAndSeverity() throws IOException {
LiveIssue i = createIssue(System.currentTimeMillis() - 3600 * 1000, "rule");
node = new IssueNode(i);
node.render(renderer);
verify(renderer).append("1 hour ago", SimpleTextAttributes.GRAY_ATTRIBUTES);
verify(renderer).append("rule");
verify(renderer).setIcon(SonarLintIcons.severity("MAJOR"));
}
use of org.sonarlint.intellij.issue.LiveIssue in project sonarlint-intellij by SonarSource.
the class IssueNodeTest method testInvalidIssue.
@Test
public void testInvalidIssue() {
LiveIssue i = createIssue(System.currentTimeMillis(), "rule");
when(i.isValid()).thenReturn(false);
node = new IssueNode(i);
node.render(renderer);
verify(renderer).append("rule", SimpleTextAttributes.GRAY_ATTRIBUTES);
}
use of org.sonarlint.intellij.issue.LiveIssue in project sonarlint-intellij by SonarSource.
the class IssueNodeTest method testAge.
@Test
public void testAge() {
LiveIssue i = createIssue(System.currentTimeMillis(), "rule");
node = new IssueNode(i);
node.render(renderer);
verify(renderer).append("few seconds ago", SimpleTextAttributes.GRAY_ATTRIBUTES);
verify(renderer).append("rule");
}
use of org.sonarlint.intellij.issue.LiveIssue in project sonarlint-intellij by SonarSource.
the class IssueNodeTest method testCount.
@Test
public void testCount() {
LiveIssue i = createIssue(System.currentTimeMillis(), "rule");
node = new IssueNode(i);
assertThat(node.getFileCount()).isZero();
assertThat(node.getIssueCount()).isEqualTo(1);
assertThat(node.issue()).isEqualTo(i);
}
Aggregations