Skip to content

Commit e874552

Browse files
committed
Polishing
1 parent 2bfb283 commit e874552

File tree

1 file changed

+10
-15
lines changed
  • spring-test/src/test/java/org/springframework/test/context/bean/override/convention

1 file changed

+10
-15
lines changed

spring-test/src/test/java/org/springframework/test/context/bean/override/convention/TestBeanTests.java

+10-15
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ void cannotOverrideBeanByTypeWithNoSuchBeanType() {
6464
.isThrownBy(context::refresh)
6565
.withMessage("""
6666
Unable to override bean: there are no beans of \
67-
type %s (as required by field '%s.example').""".formatted(
68-
String.class.getName(), FailureByTypeLookup.class.getSimpleName()));
67+
type %s (as required by field '%s.example').""",
68+
String.class.getName(), FailureByTypeLookup.class.getSimpleName());
6969
}
7070

7171
@Test
@@ -87,8 +87,8 @@ void contextCustomizerCannotBeCreatedWithMissingOverrideMethod() {
8787
assertThatIllegalStateException()
8888
.isThrownBy(() -> BeanOverrideContextCustomizerTestUtils.customizeApplicationContext(
8989
FailureMissingDefaultOverrideMethod.class, context))
90-
.withMessage("No static method found named example() or beanToOverride() in %s with return type %s"
91-
.formatted(FailureMissingDefaultOverrideMethod.class.getName(), String.class.getName()));
90+
.withMessage("No static method found named example() or beanToOverride() in %s with return type %s",
91+
FailureMissingDefaultOverrideMethod.class.getName(), String.class.getName());
9292
}
9393

9494
@Test
@@ -97,8 +97,8 @@ void contextCustomizerCannotBeCreatedWithMissingExplicitOverrideMethod() {
9797
assertThatIllegalStateException()
9898
.isThrownBy(() -> BeanOverrideContextCustomizerTestUtils.customizeApplicationContext(
9999
FailureMissingExplicitOverrideMethod.class, context))
100-
.withMessage("No static method found named createExample() in %s with return type %s"
101-
.formatted(FailureMissingExplicitOverrideMethod.class.getName(), String.class.getName()));
100+
.withMessage("No static method found named createExample() in %s with return type %s",
101+
FailureMissingExplicitOverrideMethod.class.getName(), String.class.getName());
102102
}
103103

104104
@Test
@@ -108,8 +108,8 @@ void contextCustomizerCannotBeCreatedWithFieldInParentAndMissingOverrideMethod()
108108
assertThatIllegalStateException()
109109
.isThrownBy(() -> BeanOverrideContextCustomizerTestUtils.customizeApplicationContext(
110110
FailureOverrideInParentWithoutFactoryMethod.class, context))
111-
.withMessage("No static method found named beanToOverride() in %s with return type %s"
112-
.formatted(FailureOverrideInParentWithoutFactoryMethod.class.getName(), String.class.getName()));
111+
.withMessage("No static method found named beanToOverride() in %s with return type %s",
112+
FailureOverrideInParentWithoutFactoryMethod.class.getName(), String.class.getName());
113113
}
114114

115115
@Test
@@ -119,8 +119,8 @@ void contextCustomizerCannotBeCreatedWithCompetingOverrideMethods() {
119119
assertThatIllegalStateException()
120120
.isThrownBy(() -> BeanOverrideContextCustomizerTestUtils.customizeApplicationContext(
121121
FailureCompetingOverrideMethods.class, context))
122-
.withMessage("Found 2 competing static methods named example() or beanToOverride() in %s with return type %s"
123-
.formatted(FailureCompetingOverrideMethods.class.getName(), String.class.getName()));
122+
.withMessage("Found 2 competing static methods named example() or beanToOverride() in %s with return type %s",
123+
FailureCompetingOverrideMethods.class.getName(), String.class.getName());
124124
}
125125

126126

@@ -151,7 +151,6 @@ static class FailureMissingDefaultOverrideMethod {
151151

152152
// Expected static String example() { ... }
153153
// or static String beanToOverride() { ... }
154-
155154
}
156155

157156
static class FailureMissingExplicitOverrideMethod {
@@ -160,20 +159,17 @@ static class FailureMissingExplicitOverrideMethod {
160159
private String example;
161160

162161
// Expected static String createExample() { ... }
163-
164162
}
165163

166164
abstract static class AbstractByNameLookup {
167165

168166
@TestBean(methodName = "beanToOverride")
169167
protected String beanToOverride;
170-
171168
}
172169

173170
static class FailureOverrideInParentWithoutFactoryMethod extends AbstractByNameLookup {
174171

175172
// No beanToOverride() method
176-
177173
}
178174

179175
abstract static class AbstractCompetingMethods {
@@ -191,7 +187,6 @@ static class FailureCompetingOverrideMethods extends AbstractCompetingMethods {
191187
static String beanToOverride() {
192188
throw new IllegalStateException("Should not be called");
193189
}
194-
195190
}
196191

197192
}

0 commit comments

Comments
 (0)