Skip to content

Commit 9f73357

Browse files
committed
Merge pull request #46785 from izeye
* pr/46785: Polish Closes gh-46785
2 parents b7510ff + edb38f9 commit 9f73357

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

buildSrc/src/test/java/org/springframework/boot/build/architecture/ArchitectureCheckTests.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void setup(@TempDir Path projectDir) {
5656
@Test
5757
void whenPackagesAreTangledTaskFailsAndWritesAReport() throws IOException {
5858
runGradleWithCompiledClasses("tangled",
59-
shouldHaveFailureReportWithMessage("slices matching '(**)' should be free of cycles"));
59+
shouldHaveFailureReportWithMessages("slices matching '(**)' should be free of cycles"));
6060
}
6161

6262
@Test
@@ -67,15 +67,15 @@ void whenPackagesAreNotTangledTaskSucceedsAndWritesAnEmptyReport() throws IOExce
6767
@Test
6868
void whenBeanPostProcessorBeanMethodIsNotStaticTaskFailsAndWritesAReport() throws IOException {
6969
runGradleWithCompiledClasses("bpp/nonstatic",
70-
shouldHaveFailureReportWithMessage(
70+
shouldHaveFailureReportWithMessages(
7171
"methods that are annotated with @Bean and have raw return type assignable "
7272
+ "to org.springframework.beans.factory.config.BeanPostProcessor"));
7373
}
7474

7575
@Test
7676
void whenBeanPostProcessorBeanMethodIsStaticAndHasUnsafeParametersTaskFailsAndWritesAReport() throws IOException {
7777
runGradleWithCompiledClasses("bpp/unsafeparameters",
78-
shouldHaveFailureReportWithMessage(
78+
shouldHaveFailureReportWithMessages(
7979
"methods that are annotated with @Bean and have raw return type assignable "
8080
+ "to org.springframework.beans.factory.config.BeanPostProcessor"));
8181
}
@@ -95,14 +95,14 @@ void whenBeanPostProcessorBeanMethodIsStaticAndHasNoParametersTaskSucceedsAndWri
9595
@Test
9696
void whenBeanFactoryPostProcessorBeanMethodIsNotStaticTaskFailsAndWritesAReport() throws IOException {
9797
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 "
9999
+ "type assignable to org.springframework.beans.factory.config.BeanFactoryPostProcessor"));
100100
}
101101

102102
@Test
103103
void whenBeanFactoryPostProcessorBeanMethodIsStaticAndHasParametersTaskFailsAndWritesAReport() throws IOException {
104104
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 "
106106
+ "type assignable to org.springframework.beans.factory.config.BeanFactoryPostProcessor"));
107107
}
108108

@@ -114,7 +114,7 @@ void whenBeanFactoryPostProcessorBeanMethodIsStaticAndHasNoParametersTaskSucceed
114114

115115
@Test
116116
void whenClassLoadsResourceUsingResourceUtilsTaskFailsAndWritesReport() throws IOException {
117-
runGradleWithCompiledClasses("resources/loads", shouldHaveFailureReportWithMessage(
117+
runGradleWithCompiledClasses("resources/loads", shouldHaveFailureReportWithMessages(
118118
"no classes should call method where target owner type org.springframework.util.ResourceUtils and target name 'getURL'"));
119119
}
120120

@@ -130,26 +130,26 @@ void whenClassDoesNotCallObjectsRequireNonNullTaskSucceedsAndWritesAnEmptyReport
130130

131131
@Test
132132
void whenClassCallsObjectsRequireNonNullWithMessageTaskFailsAndWritesReport() throws IOException {
133-
runGradleWithCompiledClasses("objects/requireNonNullWithString", shouldHaveFailureReportWithMessage(
133+
runGradleWithCompiledClasses("objects/requireNonNullWithString", shouldHaveFailureReportWithMessages(
134134
"no classes should call method Objects.requireNonNull(Object, String)"));
135135
}
136136

137137
@Test
138138
void whenClassCallsObjectsRequireNonNullWithSupplierTaskFailsAndWritesReport() throws IOException {
139-
runGradleWithCompiledClasses("objects/requireNonNullWithSupplier", shouldHaveFailureReportWithMessage(
139+
runGradleWithCompiledClasses("objects/requireNonNullWithSupplier", shouldHaveFailureReportWithMessages(
140140
"no classes should call method Objects.requireNonNull(Object, Supplier)"));
141141
}
142142

143143
@Test
144144
void whenClassCallsStringToUpperCaseWithoutLocaleFailsAndWritesReport() throws IOException {
145145
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"));
147147
}
148148

149149
@Test
150150
void whenClassCallsStringToLowerCaseWithoutLocaleFailsAndWritesReport() throws IOException {
151151
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"));
153153
}
154154

155155
@Test
@@ -164,7 +164,7 @@ void whenClassCallsStringToUpperCaseWithLocaleShouldNotFail() throws IOException
164164

165165
@Test
166166
void whenBeanMethodExposePrivateTypeShouldFailAndWriteReport() throws IOException {
167-
runGradleWithCompiledClasses("beans/privatebean", shouldHaveFailureReportWithMessage(
167+
runGradleWithCompiledClasses("beans/privatebean", shouldHaveFailureReportWithMessages(
168168
"methods that are annotated with @Bean should not return types declared with the PRIVATE modifier,"
169169
+ " as such types are incompatible with Spring AOT processing",
170170
"Method <org.springframework.boot.build.architecture.beans.privatebean.PrivateBean.myBean()> "
@@ -173,7 +173,7 @@ void whenBeanMethodExposePrivateTypeShouldFailAndWriteReport() throws IOExceptio
173173
}
174174

175175
@Test
176-
void whenBeanMethodExposeNonPrivateTypeeShouldNotFail() throws IOException {
176+
void whenBeanMethodExposeNonPrivateTypeShouldNotFail() throws IOException {
177177
runGradleWithCompiledClasses("beans/regular", shouldHaveEmptyFailureReport());
178178
}
179179

@@ -207,7 +207,7 @@ IntegrationMBeanExporter integrationMBeanExporter() {
207207
}
208208
}
209209
""");
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 "
211211
+ "type assignable to org.springframework.beans.factory.config.BeanPostProcessor "));
212212
}
213213

@@ -224,7 +224,7 @@ private Consumer<GradleRunner> shouldHaveEmptyFailureReport() {
224224
};
225225
}
226226

227-
private Consumer<GradleRunner> shouldHaveFailureReportWithMessage(String... messages) {
227+
private Consumer<GradleRunner> shouldHaveFailureReportWithMessages(String... messages) {
228228
return (gradleRunner) -> {
229229
assertThat(gradleRunner.buildAndFail().getOutput()).contains("BUILD FAILED")
230230
.contains("Task :checkArchitectureMain FAILED");

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsAspectsAutoConfigurationTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
3030
import org.springframework.context.annotation.Bean;
3131
import org.springframework.context.annotation.Configuration;
32-
import org.springframework.test.util.ReflectionTestUtils;
3332

3433
import static org.assertj.core.api.Assertions.assertThat;
3534

@@ -77,7 +76,7 @@ void shouldConfigureAspects() {
7776
void shouldConfigureMeterTagAnnotationHandler() {
7877
this.contextRunner.withUserConfiguration(MeterTagAnnotationHandlerConfiguration.class).run((context) -> {
7978
assertThat(context).hasSingleBean(CountedAspect.class);
80-
assertThat(ReflectionTestUtils.getField(context.getBean(TimedAspect.class), "meterTagAnnotationHandler"))
79+
assertThat(context.getBean(TimedAspect.class)).extracting("meterTagAnnotationHandler")
8180
.isSameAs(context.getBean(MeterTagAnnotationHandler.class));
8281
});
8382
}

spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/actuator/micrometertracing/gettingstarted/MyApplication.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class MyApplication {
3030
private val logger: Log = LogFactory.getLog(MyApplication::class.java)
3131

3232
@RequestMapping("/")
33-
fun hello(): String {
33+
fun home(): String {
3434
logger.info("home() has been called")
3535
return "Hello, World!"
3636
}

0 commit comments

Comments
 (0)