Skip to content

Commit 61c3d7a

Browse files
committed
Merge branch '5.3.x'
2 parents ee292ec + 03668f9 commit 61c3d7a

File tree

9 files changed

+118
-121
lines changed

9 files changed

+118
-121
lines changed

spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -322,7 +322,7 @@ void bindingWithMultipleArgsDifferentlyOrdered() {
322322
int b = 12;
323323
int c = 25;
324324
String d = "d";
325-
StringBuffer e = new StringBuffer("stringbuf");
325+
StringBuilder e = new StringBuilder("stringbuf");
326326
String expectedResult = a + b+ c + d + e;
327327
assertThat(mva.mungeArgs(a, b, c, d, e)).isEqualTo(expectedResult);
328328
}
@@ -728,12 +728,12 @@ void changeReturnType(ProceedingJoinPoint pjp, int age) throws Throwable {
728728
@Aspect
729729
static class ManyValuedArgs {
730730

731-
String mungeArgs(String a, int b, int c, String d, StringBuffer e) {
731+
String mungeArgs(String a, int b, int c, String d, StringBuilder e) {
732732
return a + b + c + d + e;
733733
}
734734

735735
@Around(value="execution(String mungeArgs(..)) && args(a, b, c, d, e)", argNames="b,c,d,e,a")
736-
String reverseAdvice(ProceedingJoinPoint pjp, int b, int c, String d, StringBuffer e, String a) throws Throwable {
736+
String reverseAdvice(ProceedingJoinPoint pjp, int b, int c, String d, StringBuilder e, String a) throws Throwable {
737737
assertThat(pjp.proceed()).isEqualTo(a + b+ c+ d+ e);
738738
return a + b + c + d + e;
739739
}

spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/DirtiesContextWithContextHierarchyTests.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -54,10 +54,10 @@
5454
class DirtiesContextWithContextHierarchyTests {
5555

5656
@Autowired
57-
private StringBuffer foo;
57+
private StringBuilder foo;
5858

5959
@Autowired
60-
private StringBuffer baz;
60+
private StringBuilder baz;
6161

6262
@Autowired
6363
private ApplicationContext context;
@@ -74,7 +74,7 @@ void verifyContextHierarchy() {
7474
@Order(1)
7575
void verifyOriginalStateAndDirtyContexts() {
7676
assertOriginalState();
77-
reverseStringBuffers();
77+
reverseStringBuilders();
7878
}
7979

8080
@Test
@@ -90,7 +90,7 @@ void verifyContextsWereDirtiedAndTriggerExhaustiveCacheClearing() {
9090
@DirtiesContext(hierarchyMode = HierarchyMode.CURRENT_LEVEL)
9191
void verifyOriginalStateWasReinstatedAndDirtyContextsAndTriggerCurrentLevelCacheClearing() {
9292
assertOriginalState();
93-
reverseStringBuffers();
93+
reverseStringBuilders();
9494
}
9595

9696
@Test
@@ -100,7 +100,7 @@ void verifyParentContextIsStillDirtyButChildContextHasBeenReinstated() {
100100
assertCleanChildContext();
101101
}
102102

103-
private void reverseStringBuffers() {
103+
private void reverseStringBuilders() {
104104
foo.reverse();
105105
baz.reverse();
106106
}
@@ -131,22 +131,22 @@ private void assertDirtyChildContext() {
131131
static class ParentConfig {
132132

133133
@Bean
134-
StringBuffer foo() {
135-
return new StringBuffer("foo");
134+
StringBuilder foo() {
135+
return new StringBuilder("foo");
136136
}
137137

138138
@Bean
139-
StringBuffer baz() {
140-
return new StringBuffer("baz-parent");
139+
StringBuilder baz() {
140+
return new StringBuilder("baz-parent");
141141
}
142142
}
143143

144144
@Configuration
145145
static class ChildConfig {
146146

147147
@Bean
148-
StringBuffer baz() {
149-
return new StringBuffer("baz-child");
148+
StringBuilder baz() {
149+
return new StringBuilder("baz-child");
150150
}
151151
}
152152

spring-tx/src/test/java/org/springframework/transaction/interceptor/RollbackRuleTests.java

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,62 +34,59 @@
3434
* @author Sam Brannen
3535
* @since 09.04.2003
3636
*/
37-
public class RollbackRuleTests {
37+
class RollbackRuleTests {
3838

3939
@Test
40-
public void foundImmediatelyWithString() {
41-
RollbackRuleAttribute rr = new RollbackRuleAttribute(java.lang.Exception.class.getName());
40+
void foundImmediatelyWithString() {
41+
RollbackRuleAttribute rr = new RollbackRuleAttribute(Exception.class.getName());
4242
assertThat(rr.getDepth(new Exception())).isEqualTo(0);
4343
}
4444

4545
@Test
46-
public void foundImmediatelyWithClass() {
46+
void foundImmediatelyWithClass() {
4747
RollbackRuleAttribute rr = new RollbackRuleAttribute(Exception.class);
4848
assertThat(rr.getDepth(new Exception())).isEqualTo(0);
4949
}
5050

5151
@Test
52-
public void notFound() {
52+
void notFound() {
5353
RollbackRuleAttribute rr = new RollbackRuleAttribute(java.io.IOException.class.getName());
5454
assertThat(rr.getDepth(new MyRuntimeException(""))).isEqualTo(-1);
5555
}
5656

5757
@Test
58-
public void ancestry() {
59-
RollbackRuleAttribute rr = new RollbackRuleAttribute(java.lang.Exception.class.getName());
58+
void ancestry() {
59+
RollbackRuleAttribute rr = new RollbackRuleAttribute(Exception.class.getName());
6060
// Exception -> Runtime -> NestedRuntime -> MyRuntimeException
6161
assertThat(rr.getDepth(new MyRuntimeException(""))).isEqualTo(3);
6262
}
6363

6464
@Test
65-
public void alwaysTrueForThrowable() {
66-
RollbackRuleAttribute rr = new RollbackRuleAttribute(java.lang.Throwable.class.getName());
67-
assertThat(rr.getDepth(new MyRuntimeException("")) > 0).isTrue();
68-
assertThat(rr.getDepth(new IOException()) > 0).isTrue();
69-
assertThat(rr.getDepth(new FatalBeanException(null,null)) > 0).isTrue();
70-
assertThat(rr.getDepth(new RuntimeException()) > 0).isTrue();
65+
void alwaysTrueForThrowable() {
66+
RollbackRuleAttribute rr = new RollbackRuleAttribute(Throwable.class.getName());
67+
assertThat(rr.getDepth(new MyRuntimeException(""))).isGreaterThan(0);
68+
assertThat(rr.getDepth(new IOException())).isGreaterThan(0);
69+
assertThat(rr.getDepth(new FatalBeanException(null, null))).isGreaterThan(0);
70+
assertThat(rr.getDepth(new RuntimeException())).isGreaterThan(0);
7171
}
7272

7373
@Test
74-
public void ctorArgMustBeAThrowableClassWithNonThrowableType() {
75-
assertThatIllegalArgumentException().isThrownBy(() ->
76-
new RollbackRuleAttribute(StringBuffer.class));
74+
void ctorArgMustBeAThrowableClassWithNonThrowableType() {
75+
assertThatIllegalArgumentException().isThrownBy(() -> new RollbackRuleAttribute(Object.class));
7776
}
7877

7978
@Test
80-
public void ctorArgMustBeAThrowableClassWithNullThrowableType() {
81-
assertThatIllegalArgumentException().isThrownBy(() ->
82-
new RollbackRuleAttribute((Class<?>) null));
79+
void ctorArgMustBeAThrowableClassWithNullThrowableType() {
80+
assertThatIllegalArgumentException().isThrownBy(() -> new RollbackRuleAttribute((Class<?>) null));
8381
}
8482

8583
@Test
86-
public void ctorArgExceptionStringNameVersionWithNull() {
87-
assertThatIllegalArgumentException().isThrownBy(() ->
88-
new RollbackRuleAttribute((String) null));
84+
void ctorArgExceptionStringNameVersionWithNull() {
85+
assertThatIllegalArgumentException().isThrownBy(() -> new RollbackRuleAttribute((String) null));
8986
}
9087

9188
@Test
92-
public void foundEnclosedExceptionWithEnclosingException() {
89+
void foundEnclosedExceptionWithEnclosingException() {
9390
RollbackRuleAttribute rr = new RollbackRuleAttribute(EnclosingException.class);
9491
assertThat(rr.getDepth(new EnclosingException.EnclosedException())).isEqualTo(0);
9592
}

spring-webmvc/src/test/java/org/springframework/web/context/ContextLoaderTests.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -57,10 +57,10 @@
5757
* @since 12.08.2003
5858
* @see org.springframework.web.context.support.Spr8510Tests
5959
*/
60-
public class ContextLoaderTests {
60+
class ContextLoaderTests {
6161

6262
@Test
63-
public void testContextLoaderListenerWithDefaultContext() {
63+
void contextLoaderListenerWithDefaultContext() {
6464
MockServletContext sc = new MockServletContext("");
6565
sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
6666
"/org/springframework/web/context/WEB-INF/applicationContext.xml " +
@@ -94,8 +94,8 @@ public void testContextLoaderListenerWithDefaultContext() {
9494
* context before calling refresh in ContextLoaders</em>.
9595
*/
9696
@Test
97-
public void testContextLoaderListenerWithCustomizedContextLoader() {
98-
final StringBuffer buffer = new StringBuffer();
97+
void contextLoaderListenerWithCustomizedContextLoader() {
98+
final StringBuilder builder = new StringBuilder();
9999
final String expectedContents = "customizeContext() was called";
100100
final MockServletContext sc = new MockServletContext("");
101101
sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
@@ -106,15 +106,15 @@ protected void customizeContext(ServletContext sc, ConfigurableWebApplicationCon
106106
assertThat(sc).as("The ServletContext should not be null.").isNotNull();
107107
assertThat(sc).as("Verifying that we received the expected ServletContext.").isEqualTo(sc);
108108
assertThat(wac.isActive()).as("The ApplicationContext should not yet have been refreshed.").isFalse();
109-
buffer.append(expectedContents);
109+
builder.append(expectedContents);
110110
}
111111
};
112112
listener.contextInitialized(new ServletContextEvent(sc));
113-
assertThat(buffer.toString()).as("customizeContext() should have been called.").isEqualTo(expectedContents);
113+
assertThat(builder.toString()).as("customizeContext() should have been called.").isEqualTo(expectedContents);
114114
}
115115

116116
@Test
117-
public void testContextLoaderListenerWithLocalContextInitializers() {
117+
void contextLoaderListenerWithLocalContextInitializers() {
118118
MockServletContext sc = new MockServletContext("");
119119
sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
120120
"org/springframework/web/context/WEB-INF/ContextLoaderTests-acc-context.xml");
@@ -129,7 +129,7 @@ public void testContextLoaderListenerWithLocalContextInitializers() {
129129
}
130130

131131
@Test
132-
public void testContextLoaderListenerWithGlobalContextInitializers() {
132+
void contextLoaderListenerWithGlobalContextInitializers() {
133133
MockServletContext sc = new MockServletContext("");
134134
sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
135135
"org/springframework/web/context/WEB-INF/ContextLoaderTests-acc-context.xml");
@@ -144,7 +144,7 @@ public void testContextLoaderListenerWithGlobalContextInitializers() {
144144
}
145145

146146
@Test
147-
public void testContextLoaderListenerWithMixedContextInitializers() {
147+
void contextLoaderListenerWithMixedContextInitializers() {
148148
MockServletContext sc = new MockServletContext("");
149149
sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
150150
"org/springframework/web/context/WEB-INF/ContextLoaderTests-acc-context.xml");
@@ -159,7 +159,7 @@ public void testContextLoaderListenerWithMixedContextInitializers() {
159159
}
160160

161161
@Test
162-
public void testContextLoaderListenerWithProgrammaticInitializers() {
162+
void contextLoaderListenerWithProgrammaticInitializers() {
163163
MockServletContext sc = new MockServletContext("");
164164
sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
165165
"org/springframework/web/context/WEB-INF/ContextLoaderTests-acc-context.xml");
@@ -173,7 +173,7 @@ public void testContextLoaderListenerWithProgrammaticInitializers() {
173173
}
174174

175175
@Test
176-
public void testContextLoaderListenerWithProgrammaticAndLocalInitializers() {
176+
void contextLoaderListenerWithProgrammaticAndLocalInitializers() {
177177
MockServletContext sc = new MockServletContext("");
178178
sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
179179
"org/springframework/web/context/WEB-INF/ContextLoaderTests-acc-context.xml");
@@ -188,7 +188,7 @@ public void testContextLoaderListenerWithProgrammaticAndLocalInitializers() {
188188
}
189189

190190
@Test
191-
public void testContextLoaderListenerWithProgrammaticAndGlobalInitializers() {
191+
void contextLoaderListenerWithProgrammaticAndGlobalInitializers() {
192192
MockServletContext sc = new MockServletContext("");
193193
sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
194194
"org/springframework/web/context/WEB-INF/ContextLoaderTests-acc-context.xml");
@@ -203,7 +203,7 @@ public void testContextLoaderListenerWithProgrammaticAndGlobalInitializers() {
203203
}
204204

205205
@Test
206-
public void testRegisteredContextInitializerCanAccessServletContextParamsViaEnvironment() {
206+
void registeredContextInitializerCanAccessServletContextParamsViaEnvironment() {
207207
MockServletContext sc = new MockServletContext("");
208208
// config file doesn't matter - just a placeholder
209209
sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
@@ -217,7 +217,7 @@ public void testRegisteredContextInitializerCanAccessServletContextParamsViaEnvi
217217
}
218218

219219
@Test
220-
public void testContextLoaderListenerWithUnknownContextInitializer() {
220+
void contextLoaderListenerWithUnknownContextInitializer() {
221221
MockServletContext sc = new MockServletContext("");
222222
// config file doesn't matter. just a placeholder
223223
sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
@@ -231,7 +231,7 @@ public void testContextLoaderListenerWithUnknownContextInitializer() {
231231
}
232232

233233
@Test
234-
public void testContextLoaderWithCustomContext() throws Exception {
234+
void contextLoaderWithCustomContext() throws Exception {
235235
MockServletContext sc = new MockServletContext("");
236236
sc.addInitParameter(ContextLoader.CONTEXT_CLASS_PARAM,
237237
"org.springframework.web.servlet.SimpleWebApplicationContext");
@@ -245,7 +245,7 @@ public void testContextLoaderWithCustomContext() throws Exception {
245245
}
246246

247247
@Test
248-
public void testContextLoaderWithInvalidLocation() throws Exception {
248+
void contextLoaderWithInvalidLocation() throws Exception {
249249
MockServletContext sc = new MockServletContext("");
250250
sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM, "/WEB-INF/myContext.xml");
251251
ServletContextListener listener = new ContextLoaderListener();
@@ -256,7 +256,7 @@ public void testContextLoaderWithInvalidLocation() throws Exception {
256256
}
257257

258258
@Test
259-
public void testContextLoaderWithInvalidContext() throws Exception {
259+
void contextLoaderWithInvalidContext() throws Exception {
260260
MockServletContext sc = new MockServletContext("");
261261
sc.addInitParameter(ContextLoader.CONTEXT_CLASS_PARAM,
262262
"org.springframework.web.context.support.InvalidWebApplicationContext");
@@ -268,7 +268,7 @@ public void testContextLoaderWithInvalidContext() throws Exception {
268268
}
269269

270270
@Test
271-
public void testContextLoaderWithDefaultLocation() throws Exception {
271+
void contextLoaderWithDefaultLocation() throws Exception {
272272
MockServletContext sc = new MockServletContext("");
273273
ServletContextListener listener = new ContextLoaderListener();
274274
ServletContextEvent event = new ServletContextEvent(sc);
@@ -280,7 +280,7 @@ public void testContextLoaderWithDefaultLocation() throws Exception {
280280
}
281281

282282
@Test
283-
public void testFrameworkServletWithDefaultLocation() throws Exception {
283+
void frameworkServletWithDefaultLocation() throws Exception {
284284
DispatcherServlet servlet = new DispatcherServlet();
285285
servlet.setContextClass(XmlWebApplicationContext.class);
286286
assertThatExceptionOfType(BeanDefinitionStoreException.class)
@@ -291,7 +291,7 @@ public void testFrameworkServletWithDefaultLocation() throws Exception {
291291
}
292292

293293
@Test
294-
public void testFrameworkServletWithCustomLocation() throws Exception {
294+
void frameworkServletWithCustomLocation() throws Exception {
295295
DispatcherServlet servlet = new DispatcherServlet();
296296
servlet.setContextConfigLocation("/org/springframework/web/context/WEB-INF/testNamespace.xml "
297297
+ "/org/springframework/web/context/WEB-INF/context-addition.xml");
@@ -302,7 +302,7 @@ public void testFrameworkServletWithCustomLocation() throws Exception {
302302

303303
@Test
304304
@SuppressWarnings("resource")
305-
public void testClassPathXmlApplicationContext() throws IOException {
305+
void classPathXmlApplicationContext() throws IOException {
306306
ApplicationContext context = new ClassPathXmlApplicationContext(
307307
"/org/springframework/web/context/WEB-INF/applicationContext.xml");
308308
assertThat(context.containsBean("father")).as("Has father").isTrue();
@@ -321,7 +321,7 @@ public void testClassPathXmlApplicationContext() throws IOException {
321321

322322
@Test
323323
@SuppressWarnings("resource")
324-
public void testSingletonDestructionOnStartupFailure() throws IOException {
324+
void singletonDestructionOnStartupFailure() throws IOException {
325325
assertThatExceptionOfType(BeanCreationException.class).isThrownBy(() ->
326326
new ClassPathXmlApplicationContext(new String[] {
327327
"/org/springframework/web/context/WEB-INF/applicationContext.xml",

spring-webmvc/src/test/java/org/springframework/web/servlet/tags/HtmlEscapeTagOutsideDispatcherServletTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@
2020
* @author Juergen Hoeller
2121
* @since 14.01.2005
2222
*/
23-
public class HtmlEscapeTagOutsideDispatcherServletTests extends HtmlEscapeTagTests {
23+
class HtmlEscapeTagOutsideDispatcherServletTests extends HtmlEscapeTagTests {
2424

2525
@Override
2626
protected boolean inDispatcherServlet() {

0 commit comments

Comments
 (0)