@@ -56,7 +56,7 @@ void setup(@TempDir Path projectDir) {
56
56
@ Test
57
57
void whenPackagesAreTangledTaskFailsAndWritesAReport () throws IOException {
58
58
runGradleWithCompiledClasses ("tangled" ,
59
- shouldHaveFailureReportWithMessage ("slices matching '(**)' should be free of cycles" ));
59
+ shouldHaveFailureReportWithMessages ("slices matching '(**)' should be free of cycles" ));
60
60
}
61
61
62
62
@ Test
@@ -67,15 +67,15 @@ void whenPackagesAreNotTangledTaskSucceedsAndWritesAnEmptyReport() throws IOExce
67
67
@ Test
68
68
void whenBeanPostProcessorBeanMethodIsNotStaticTaskFailsAndWritesAReport () throws IOException {
69
69
runGradleWithCompiledClasses ("bpp/nonstatic" ,
70
- shouldHaveFailureReportWithMessage (
70
+ shouldHaveFailureReportWithMessages (
71
71
"methods that are annotated with @Bean and have raw return type assignable "
72
72
+ "to org.springframework.beans.factory.config.BeanPostProcessor" ));
73
73
}
74
74
75
75
@ Test
76
76
void whenBeanPostProcessorBeanMethodIsStaticAndHasUnsafeParametersTaskFailsAndWritesAReport () throws IOException {
77
77
runGradleWithCompiledClasses ("bpp/unsafeparameters" ,
78
- shouldHaveFailureReportWithMessage (
78
+ shouldHaveFailureReportWithMessages (
79
79
"methods that are annotated with @Bean and have raw return type assignable "
80
80
+ "to org.springframework.beans.factory.config.BeanPostProcessor" ));
81
81
}
@@ -95,14 +95,14 @@ void whenBeanPostProcessorBeanMethodIsStaticAndHasNoParametersTaskSucceedsAndWri
95
95
@ Test
96
96
void whenBeanFactoryPostProcessorBeanMethodIsNotStaticTaskFailsAndWritesAReport () throws IOException {
97
97
runGradleWithCompiledClasses ("bfpp/nonstatic" ,
98
- shouldHaveFailureReportWithMessage ("methods that are annotated with @Bean and have raw return "
98
+ shouldHaveFailureReportWithMessages ("methods that are annotated with @Bean and have raw return "
99
99
+ "type assignable to org.springframework.beans.factory.config.BeanFactoryPostProcessor" ));
100
100
}
101
101
102
102
@ Test
103
103
void whenBeanFactoryPostProcessorBeanMethodIsStaticAndHasParametersTaskFailsAndWritesAReport () throws IOException {
104
104
runGradleWithCompiledClasses ("bfpp/parameters" ,
105
- shouldHaveFailureReportWithMessage ("methods that are annotated with @Bean and have raw return "
105
+ shouldHaveFailureReportWithMessages ("methods that are annotated with @Bean and have raw return "
106
106
+ "type assignable to org.springframework.beans.factory.config.BeanFactoryPostProcessor" ));
107
107
}
108
108
@@ -114,7 +114,7 @@ void whenBeanFactoryPostProcessorBeanMethodIsStaticAndHasNoParametersTaskSucceed
114
114
115
115
@ Test
116
116
void whenClassLoadsResourceUsingResourceUtilsTaskFailsAndWritesReport () throws IOException {
117
- runGradleWithCompiledClasses ("resources/loads" , shouldHaveFailureReportWithMessage (
117
+ runGradleWithCompiledClasses ("resources/loads" , shouldHaveFailureReportWithMessages (
118
118
"no classes should call method where target owner type org.springframework.util.ResourceUtils and target name 'getURL'" ));
119
119
}
120
120
@@ -130,26 +130,26 @@ void whenClassDoesNotCallObjectsRequireNonNullTaskSucceedsAndWritesAnEmptyReport
130
130
131
131
@ Test
132
132
void whenClassCallsObjectsRequireNonNullWithMessageTaskFailsAndWritesReport () throws IOException {
133
- runGradleWithCompiledClasses ("objects/requireNonNullWithString" , shouldHaveFailureReportWithMessage (
133
+ runGradleWithCompiledClasses ("objects/requireNonNullWithString" , shouldHaveFailureReportWithMessages (
134
134
"no classes should call method Objects.requireNonNull(Object, String)" ));
135
135
}
136
136
137
137
@ Test
138
138
void whenClassCallsObjectsRequireNonNullWithSupplierTaskFailsAndWritesReport () throws IOException {
139
- runGradleWithCompiledClasses ("objects/requireNonNullWithSupplier" , shouldHaveFailureReportWithMessage (
139
+ runGradleWithCompiledClasses ("objects/requireNonNullWithSupplier" , shouldHaveFailureReportWithMessages (
140
140
"no classes should call method Objects.requireNonNull(Object, Supplier)" ));
141
141
}
142
142
143
143
@ Test
144
144
void whenClassCallsStringToUpperCaseWithoutLocaleFailsAndWritesReport () throws IOException {
145
145
runGradleWithCompiledClasses ("string/toUpperCase" ,
146
- shouldHaveFailureReportWithMessage ("because String.toUpperCase(Locale.ROOT) should be used instead" ));
146
+ shouldHaveFailureReportWithMessages ("because String.toUpperCase(Locale.ROOT) should be used instead" ));
147
147
}
148
148
149
149
@ Test
150
150
void whenClassCallsStringToLowerCaseWithoutLocaleFailsAndWritesReport () throws IOException {
151
151
runGradleWithCompiledClasses ("string/toLowerCase" ,
152
- shouldHaveFailureReportWithMessage ("because String.toLowerCase(Locale.ROOT) should be used instead" ));
152
+ shouldHaveFailureReportWithMessages ("because String.toLowerCase(Locale.ROOT) should be used instead" ));
153
153
}
154
154
155
155
@ Test
@@ -164,7 +164,7 @@ void whenClassCallsStringToUpperCaseWithLocaleShouldNotFail() throws IOException
164
164
165
165
@ Test
166
166
void whenBeanMethodExposePrivateTypeShouldFailAndWriteReport () throws IOException {
167
- runGradleWithCompiledClasses ("beans/privatebean" , shouldHaveFailureReportWithMessage (
167
+ runGradleWithCompiledClasses ("beans/privatebean" , shouldHaveFailureReportWithMessages (
168
168
"methods that are annotated with @Bean should not return types declared with the PRIVATE modifier,"
169
169
+ " as such types are incompatible with Spring AOT processing" ,
170
170
"Method <org.springframework.boot.build.architecture.beans.privatebean.PrivateBean.myBean()> "
@@ -173,7 +173,7 @@ void whenBeanMethodExposePrivateTypeShouldFailAndWriteReport() throws IOExceptio
173
173
}
174
174
175
175
@ Test
176
- void whenBeanMethodExposeNonPrivateTypeeShouldNotFail () throws IOException {
176
+ void whenBeanMethodExposeNonPrivateTypeShouldNotFail () throws IOException {
177
177
runGradleWithCompiledClasses ("beans/regular" , shouldHaveEmptyFailureReport ());
178
178
}
179
179
@@ -207,7 +207,7 @@ IntegrationMBeanExporter integrationMBeanExporter() {
207
207
}
208
208
}
209
209
""" );
210
- runGradle (shouldHaveFailureReportWithMessage ("methods that are annotated with @Bean and have raw return "
210
+ runGradle (shouldHaveFailureReportWithMessages ("methods that are annotated with @Bean and have raw return "
211
211
+ "type assignable to org.springframework.beans.factory.config.BeanPostProcessor " ));
212
212
}
213
213
@@ -224,7 +224,7 @@ private Consumer<GradleRunner> shouldHaveEmptyFailureReport() {
224
224
};
225
225
}
226
226
227
- private Consumer <GradleRunner > shouldHaveFailureReportWithMessage (String ... messages ) {
227
+ private Consumer <GradleRunner > shouldHaveFailureReportWithMessages (String ... messages ) {
228
228
return (gradleRunner ) -> {
229
229
assertThat (gradleRunner .buildAndFail ().getOutput ()).contains ("BUILD FAILED" )
230
230
.contains ("Task :checkArchitectureMain FAILED" );
0 commit comments