From c2d8142054c936010bbf943f40b90087ec2cb6a0 Mon Sep 17 00:00:00 2001 From: Nicolas QUINQUENEL Date: Tue, 12 Nov 2024 09:06:08 +0100 Subject: [PATCH] SLI-1699 Get rid of SLOOP deprecated usages --- .../java/org/sonarlint/intellij/SonarLintTestUtils.java | 4 ---- .../org/sonarlint/intellij/ui/nodes/IssueNodeTests.java | 4 ---- .../intellij/ui/nodes/SecurityHotspotNodeTests.java | 4 ---- .../intellij/ui/tree/IssueTreeModelBuilderTests.java | 7 ------- .../ui/tree/SecurityHotspotTreeModelBuilderTests.java | 4 ---- 5 files changed, 23 deletions(-) diff --git a/src/test/java/org/sonarlint/intellij/SonarLintTestUtils.java b/src/test/java/org/sonarlint/intellij/SonarLintTestUtils.java index a8eb6ca8a..34024bc0a 100644 --- a/src/test/java/org/sonarlint/intellij/SonarLintTestUtils.java +++ b/src/test/java/org/sonarlint/intellij/SonarLintTestUtils.java @@ -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; @@ -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; } } diff --git a/src/test/java/org/sonarlint/intellij/ui/nodes/IssueNodeTests.java b/src/test/java/org/sonarlint/intellij/ui/nodes/IssueNodeTests.java index 89ce7b618..3aab92350 100644 --- a/src/test/java/org/sonarlint/intellij/ui/nodes/IssueNodeTests.java +++ b/src/test/java/org/sonarlint/intellij/ui/nodes/IssueNodeTests.java @@ -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; @@ -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; diff --git a/src/test/java/org/sonarlint/intellij/ui/nodes/SecurityHotspotNodeTests.java b/src/test/java/org/sonarlint/intellij/ui/nodes/SecurityHotspotNodeTests.java index e029d7b3d..fa73f6c88 100644 --- a/src/test/java/org/sonarlint/intellij/ui/nodes/SecurityHotspotNodeTests.java +++ b/src/test/java/org/sonarlint/intellij/ui/nodes/SecurityHotspotNodeTests.java @@ -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; @@ -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()); } } diff --git a/src/test/java/org/sonarlint/intellij/ui/tree/IssueTreeModelBuilderTests.java b/src/test/java/org/sonarlint/intellij/ui/tree/IssueTreeModelBuilderTests.java index efd10feca..823da4397 100644 --- a/src/test/java/org/sonarlint/intellij/ui/tree/IssueTreeModelBuilderTests.java +++ b/src/test/java/org/sonarlint/intellij/ui/tree/IssueTreeModelBuilderTests.java @@ -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); @@ -172,10 +169,6 @@ private LiveIssue mockIssuePointer(int startOffset, String rule, List 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); diff --git a/src/test/java/org/sonarlint/intellij/ui/tree/SecurityHotspotTreeModelBuilderTests.java b/src/test/java/org/sonarlint/intellij/ui/tree/SecurityHotspotTreeModelBuilderTests.java index 18fdc8fd1..605806c29 100644 --- a/src/test/java/org/sonarlint/intellij/ui/tree/SecurityHotspotTreeModelBuilderTests.java +++ b/src/test/java/org/sonarlint/intellij/ui/tree/SecurityHotspotTreeModelBuilderTests.java @@ -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; @@ -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("");