15
15
*/
16
16
package org .springframework .sbm .boot .upgrade_27_30 .report ;
17
17
18
+ import org .assertj .core .api .Assertions ;
18
19
import org .junit .jupiter .api .DisplayName ;
19
20
import org .junit .jupiter .api .Test ;
20
21
import org .springframework .sbm .boot .properties .SpringApplicationPropertiesPathMatcher ;
31
32
public class ChangesToDataPropertiesReportTest {
32
33
33
34
@ Test
34
- @ DisplayName ("Changes to Data Properties" )
35
- void changesToDataPropertiesSection () {
35
+ @ DisplayName ("Changes to Data Properties should render " )
36
+ void changesToDataPropertiesSection_renders () {
36
37
ProjectContext context = TestProjectContext .buildProjectContext ()
37
38
.addRegistrar (new SpringBootApplicationPropertiesRegistrar (new SpringApplicationPropertiesPathMatcher ()))
38
39
.addProjectResource ("src/main/resources/application.properties" , "spring.data.foo=bar" )
@@ -44,7 +45,7 @@ void changesToDataPropertiesSection() {
44
45
.shouldRenderAs (
45
46
"""
46
47
=== Changes to Data Properties
47
- Issue: https://github.com/spring-projects-experimental/spring-boot-migrator/issues/123[#123 ], Contributors: https://github.com/fabapp2[@fabapp2^, role="ext-link"]
48
+ Issue: https://github.com/spring-projects-experimental/spring-boot-migrator/issues/441[#441 ], Contributors: https://github.com/fabapp2[@fabapp2^, role="ext-link"]
48
49
49
50
==== What Changed
50
51
The data prefix has been reserved for Spring Data and any properties under the `data` prefix imply that Spring
@@ -53,10 +54,10 @@ void changesToDataPropertiesSection() {
53
54
==== Why is the application affected
54
55
The scan found properties with `spring.data` prefix but no dependency matching `org.springframework.data:.*`.
55
56
56
- * file://<PATH>/src/main/resources/application.properties[`src/main/resources/application.properties`]
57
- ** `spring.data.foo`
58
- * file://<PATH>/src/main/resources/application-another.properties[`src/main/resources/application-another.properties`]
59
- ** `spring.data.here`
57
+ * file://<PATH>/src/main/resources/application.properties[`src/main/resources/application.properties`]
58
+ ** `spring.data.foo`
59
+ * file://<PATH>/src/main/resources/application-another.properties[`src/main/resources/application-another.properties`]
60
+ ** `spring.data.here`
60
61
61
62
==== Remediation
62
63
Either add `spring-data` dependency, rename the property or remove it in case it's not required anymore.
@@ -65,4 +66,18 @@ void changesToDataPropertiesSection() {
65
66
.of ("." ).toAbsolutePath ().resolve (TestProjectContext .getDefaultProjectRoot ()).toString ()));
66
67
}
67
68
69
+ @ Test
70
+ @ DisplayName ("Changes to Data Properties shouldn't render" )
71
+ void changesToDataPropertiesSection_notRendered () {
72
+ ProjectContext context = TestProjectContext .buildProjectContext ()
73
+ .addRegistrar (new SpringBootApplicationPropertiesRegistrar (new SpringApplicationPropertiesPathMatcher ()))
74
+ .addProjectResource ("src/main/resources/application.properties" , "data.foo=bar" )
75
+ .addProjectResource ("src/main/resources/application-another.properties" , "data.here=there" )
76
+ .build ();
77
+
78
+ SpringBootUpgradeReportTestSupport .generatedSection ("Changes to Data Properties" )
79
+ .fromProjectContext (context )
80
+ .shouldNotRender ();
81
+ }
82
+
68
83
}
0 commit comments