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 8d3a71e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 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

0 comments on commit 8d3a71e

Please sign in to comment.