Skip to content

Commit

Permalink
Fix Java ITs
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastien-marichal committed Aug 9, 2024
1 parent ce8ae45 commit 5a777ff
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion its/projects/WebConfig.CSharp/WebConfig.CSharp/Dummy.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
public class Dummy
{
// This is present just to have a file to analyze.
public int Prop => 42;
public static int Prop => 42;
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,12 @@ void firstProjectFirstClassIssues() {
.collect(Collectors.toList());

assertThat(barIssues)
.hasSize(2)
.hasSize(3)
.extracting(Issues.Issue::getRule, Issues.Issue::getLine)
.containsExactlyInAnyOrder(
tuple("csharpsquid:S1134", 3),
tuple("csharpsquid:S1135", 4));
tuple("csharpsquid:S1135", 4),
tuple("csharpsquid:S2325", 16));
}

@Test
Expand All @@ -114,7 +115,9 @@ void secondProjectFirstClassIssues() {

assertThat(barIssues)
.extracting(Issues.Issue::getRule, Issues.Issue::getLine)
.containsExactlyInAnyOrder(tuple("csharpsquid:S1135", 1));
.containsExactlyInAnyOrder(
tuple("csharpsquid:S1135", 1),
tuple("csharpsquid:S2325", 10));
}

/* Files */
Expand Down
13 changes: 8 additions & 5 deletions its/src/test/java/com/sonar/it/csharp/NoSonarTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

import static com.sonar.it.csharp.Tests.ORCHESTRATOR;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.tuple;

@ExtendWith(Tests.class)
public class NoSonarTest {
Expand All @@ -49,11 +50,13 @@ public static void init() throws Exception {
@Test
void excludeNoSonarComment() {
List<Issues.Issue> issues = TestUtils.getIssues(ORCHESTRATOR, PROJECT);
assertThat(issues).hasSize(2);
assertThat(issues.get(0).getLine()).isEqualTo(3);
assertThat(issues.get(0).getRule()).isEqualTo("csharpsquid:S101");
assertThat(issues.get(1).getLine()).isEqualTo(5);
assertThat(issues.get(1).getRule()).isEqualTo("external_roslyn:CA1822");
assertThat(issues)
.hasSize(3)
.extracting(Issues.Issue::getRule, Issues.Issue::getLine)
.containsExactlyInAnyOrder(
tuple("csharpsquid:S101", 3),
tuple("external_roslyn:CA1822", 5),
tuple("csharpsquid:S2325", 5));
}

@Test
Expand Down
6 changes: 3 additions & 3 deletions its/src/test/java/com/sonar/it/csharp/WebConfigTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ void should_raise_hotspot_on_web_config() throws IOException {
assertContentLengthHotspot(hotspots.get(5), 14, "WebConfig.CSharp/Web.config");

List<Issues.Issue> issues = Tests.getIssues(PROJECT);
assertThat(issues).hasSize(6);
assertThat(issues).hasSize(7);
assertIssue(issues.get(0), 9, "PathOutsideProjectRoot/Web.config");
assertIssue(issues.get(1), 3, "PathOutsideProjectRoot/appsettings.json");
assertIssue(issues.get(4), 9, "WebConfig.CSharp/Web.config");
assertIssue(issues.get(5), 3, "WebConfig.CSharp/appsettings.json");
assertIssue(issues.get(5), 9, "WebConfig.CSharp/Web.config");
assertIssue(issues.get(6), 3, "WebConfig.CSharp/appsettings.json");
}
}

0 comments on commit 5a777ff

Please sign in to comment.