Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions its/ruling/src/test/resources/expected/mall/java-S4605.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,21 @@ class SpringBeansShouldBeAccessibleCrossModuleTest extends ScannerIntegrationAbs

@Test
void test() {
var issues = analyze(Path.of("spring-beans-should-be-accessible"), "S4605", "S1874");
var issues = analyze(Path.of("spring-beans-should-be-accessible"), "S4605");
assertThat(issues)
.hasSize(3)
.contains(new TextRangeIssue(
"moduleA/src/main/java/packageB/MyComponentB.java",
"java:S4605",
"'MyComponentB' is not reachable by @ComponentScan or @SpringBootApplication. Either move it to a package configured in @ComponentScan or update your @ComponentScan configuration.",
new TextRange(6, 6, 13, 25)));
.containsExactlyInAnyOrder(
new TextRangeIssue(
"moduleA/src/main/java/packageB/MyComponentB.java",
"java:S4605",
"'MyComponentB' is not reachable by @ComponentScan or @SpringBootApplication. Either move it to a package configured in @ComponentScan or update your @ComponentScan " +
"configuration.",
new TextRange(6, 6, 13, 25)),
new TextRangeIssue(
"moduleB/src/main/java/packageC/OtherComponent.java",
"java:S4605",
"'OtherComponent' is not reachable by @ComponentScan or @SpringBootApplication. Either move it to a package configured in @ComponentScan or update your @ComponentScan " +
"configuration.",
new TextRange(7, 7, 13, 27))
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package packageA.subpackage;

import org.springframework.stereotype.Component;

@Component
public class CrossModuleComponent {
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package checks.spring.s4605;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

// Declares the only scanned package of this test package: checks.spring.s4605.scanned. Paired with
// ScannedComponent (covered) and UnscannedComponent (not covered).
@Configuration
@ComponentScan("checks.spring.s4605.scanned")
public class ScanConfiguration {
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package checks.spring.s4605.scanned;

import org.springframework.stereotype.Component;

@Component
public class ScannedComponent {
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading