Skip to content

Commit

Permalink
SLI-1699 Get rid of SLOOP deprecated usages
Browse files Browse the repository at this point in the history
  • Loading branch information
nquinquenel committed Nov 12, 2024
1 parent 75ae02f commit c2d8142
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 23 deletions.
4 changes: 0 additions & 4 deletions src/test/java/org/sonarlint/intellij/SonarLintTestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import java.awt.GraphicsEnvironment;
import javax.annotation.Nullable;
import org.sonarsource.sonarlint.core.rpc.protocol.client.issue.RaisedIssueDto;
import org.sonarsource.sonarlint.core.rpc.protocol.common.CleanCodeAttribute;
import org.sonarsource.sonarlint.core.rpc.protocol.common.Either;
import org.sonarsource.sonarlint.core.rpc.protocol.common.IssueSeverity;
import org.sonarsource.sonarlint.core.rpc.protocol.common.RuleType;
Expand Down Expand Up @@ -53,9 +52,6 @@ public static RaisedIssueDto createIssue(int id) {
when(issue.getRuleKey()).thenReturn(Integer.toString(id));
when(issue.getPrimaryMessage()).thenReturn("issue " + id);
when(issue.getSeverityMode()).thenReturn(Either.forLeft(new StandardModeDetails(IssueSeverity.MAJOR, RuleType.BUG)));
when(issue.getSeverity()).thenReturn(IssueSeverity.MAJOR);
when(issue.getType()).thenReturn(RuleType.BUG);
when(issue.getCleanCodeAttribute()).thenReturn(CleanCodeAttribute.COMPLETE);
return issue;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.junit.jupiter.api.Test;
import org.sonarlint.intellij.finding.issue.LiveIssue;
import org.sonarsource.sonarlint.core.rpc.protocol.client.issue.RaisedIssueDto;
import org.sonarsource.sonarlint.core.rpc.protocol.common.CleanCodeAttribute;
import org.sonarsource.sonarlint.core.rpc.protocol.common.Either;
import org.sonarsource.sonarlint.core.rpc.protocol.common.IssueSeverity;
import org.sonarsource.sonarlint.core.rpc.protocol.common.RuleType;
Expand All @@ -52,9 +51,6 @@ private static LiveIssue createIssue(Instant date, String message) {
var issue = mock(RaisedIssueDto.class);
when(issue.getPrimaryMessage()).thenReturn(message);
when(issue.getSeverityMode()).thenReturn(Either.forLeft(new StandardModeDetails(IssueSeverity.MAJOR, RuleType.BUG)));
when(issue.getSeverity()).thenReturn(IssueSeverity.MAJOR);
when(issue.getType()).thenReturn(RuleType.BUG);
when(issue.getCleanCodeAttribute()).thenReturn(CleanCodeAttribute.COMPLETE);
var issuePointer = new LiveIssue(null, issue, file, Collections.emptyList());
issuePointer.setIntroductionDate(date);
return issuePointer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.sonarlint.intellij.finding.hotspot.LiveSecurityHotspot;
import org.sonarsource.sonarlint.core.rpc.protocol.backend.rules.VulnerabilityProbability;
import org.sonarsource.sonarlint.core.rpc.protocol.client.hotspot.RaisedHotspotDto;
import org.sonarsource.sonarlint.core.rpc.protocol.common.CleanCodeAttribute;
import org.sonarsource.sonarlint.core.rpc.protocol.common.Either;
import org.sonarsource.sonarlint.core.rpc.protocol.common.IssueSeverity;
import org.sonarsource.sonarlint.core.rpc.protocol.common.RuleType;
Expand All @@ -52,9 +51,6 @@ private static LiveSecurityHotspot createSecurityHotspot() {
when(issue.getPrimaryMessage()).thenReturn("rule");
when(issue.getVulnerabilityProbability()).thenReturn(VulnerabilityProbability.HIGH);
when(issue.getSeverityMode()).thenReturn(Either.forLeft(new StandardModeDetails(IssueSeverity.BLOCKER, RuleType.BUG)));
when(issue.getType()).thenReturn(RuleType.BUG);
when(issue.getSeverity()).thenReturn(IssueSeverity.BLOCKER);
when(issue.getCleanCodeAttribute()).thenReturn(CleanCodeAttribute.COMPLETE);
return new LiveSecurityHotspot(null, issue, file, Collections.emptyList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,6 @@ private LiveIssue mockIssuePointer(int startOffset, String rule, IssueSeverity s
var issue = mock(RaisedIssueDto.class);
when(issue.getRuleKey()).thenReturn(rule);
when(issue.getSeverityMode()).thenReturn(Either.forLeft(new StandardModeDetails(severity, RuleType.BUG)));
when(issue.getSeverity()).thenReturn(severity);
when(issue.getType()).thenReturn(RuleType.BUG);
when(issue.getCleanCodeAttribute()).thenReturn(CleanCodeAttribute.COMPLETE);

var marker = mock(RangeMarker.class);
when(marker.getStartOffset()).thenReturn(startOffset);
Expand All @@ -172,10 +169,6 @@ private LiveIssue mockIssuePointer(int startOffset, String rule, List<ImpactDto>
var issue = mock(RaisedIssueDto.class);
when(issue.getRuleKey()).thenReturn(rule);
when(issue.getSeverityMode()).thenReturn(Either.forRight(new MQRModeDetails(CleanCodeAttribute.CONVENTIONAL, impacts)));
when(issue.getType()).thenReturn(RuleType.BUG);
when(issue.getCleanCodeAttribute()).thenReturn(CleanCodeAttribute.CONVENTIONAL);
when(issue.getImpacts()).thenReturn(impacts);
when(issue.getSeverity()).thenReturn(IssueSeverity.BLOCKER);

var marker = mock(RangeMarker.class);
when(marker.getStartOffset()).thenReturn(startOffset);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import org.sonarsource.sonarlint.core.rpc.protocol.backend.hotspot.HotspotStatus;
import org.sonarsource.sonarlint.core.rpc.protocol.backend.rules.VulnerabilityProbability;
import org.sonarsource.sonarlint.core.rpc.protocol.client.hotspot.RaisedHotspotDto;
import org.sonarsource.sonarlint.core.rpc.protocol.common.CleanCodeAttribute;
import org.sonarsource.sonarlint.core.rpc.protocol.common.Either;
import org.sonarsource.sonarlint.core.rpc.protocol.common.IssueSeverity;
import org.sonarsource.sonarlint.core.rpc.protocol.common.RuleType;
Expand Down Expand Up @@ -254,11 +253,8 @@ private LiveSecurityHotspot mockSecurityHotspot(String path, int startOffset, St

var issue = mock(RaisedHotspotDto.class);
when(issue.getSeverityMode()).thenReturn(Either.forLeft(new StandardModeDetails(IssueSeverity.BLOCKER, RuleType.SECURITY_HOTSPOT)));
when(issue.getSeverity()).thenReturn(IssueSeverity.BLOCKER);
when(issue.getRuleKey()).thenReturn(rule);
when(issue.getVulnerabilityProbability()).thenReturn(vulnerability);
when(issue.getType()).thenReturn(RuleType.SECURITY_HOTSPOT);
when(issue.getCleanCodeAttribute()).thenReturn(CleanCodeAttribute.COMPLETE);

var document = mock(Document.class);
when(document.getText(any())).thenReturn("");
Expand Down

0 comments on commit c2d8142

Please sign in to comment.