Replace remaining use of StringBuffer with StringBuilder
Although this commit only applies to test classes, it serves to reduce the noise when searching for undesirable usage of StringBuffer in production code.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -54,10 +54,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
class DirtiesContextWithContextHierarchyTests {
|
||||
|
||||
@Autowired
|
||||
private StringBuffer foo;
|
||||
private StringBuilder foo;
|
||||
|
||||
@Autowired
|
||||
private StringBuffer baz;
|
||||
private StringBuilder baz;
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
@@ -74,7 +74,7 @@ class DirtiesContextWithContextHierarchyTests {
|
||||
@Order(1)
|
||||
void verifyOriginalStateAndDirtyContexts() {
|
||||
assertOriginalState();
|
||||
reverseStringBuffers();
|
||||
reverseStringBuilders();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -90,7 +90,7 @@ class DirtiesContextWithContextHierarchyTests {
|
||||
@DirtiesContext(hierarchyMode = HierarchyMode.CURRENT_LEVEL)
|
||||
void verifyOriginalStateWasReinstatedAndDirtyContextsAndTriggerCurrentLevelCacheClearing() {
|
||||
assertOriginalState();
|
||||
reverseStringBuffers();
|
||||
reverseStringBuilders();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -100,7 +100,7 @@ class DirtiesContextWithContextHierarchyTests {
|
||||
assertCleanChildContext();
|
||||
}
|
||||
|
||||
private void reverseStringBuffers() {
|
||||
private void reverseStringBuilders() {
|
||||
foo.reverse();
|
||||
baz.reverse();
|
||||
}
|
||||
@@ -131,13 +131,13 @@ class DirtiesContextWithContextHierarchyTests {
|
||||
static class ParentConfig {
|
||||
|
||||
@Bean
|
||||
StringBuffer foo() {
|
||||
return new StringBuffer("foo");
|
||||
StringBuilder foo() {
|
||||
return new StringBuilder("foo");
|
||||
}
|
||||
|
||||
@Bean
|
||||
StringBuffer baz() {
|
||||
return new StringBuffer("baz-parent");
|
||||
StringBuilder baz() {
|
||||
return new StringBuilder("baz-parent");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,8 +145,8 @@ class DirtiesContextWithContextHierarchyTests {
|
||||
static class ChildConfig {
|
||||
|
||||
@Bean
|
||||
StringBuffer baz() {
|
||||
return new StringBuffer("baz-child");
|
||||
StringBuilder baz() {
|
||||
return new StringBuilder("baz-child");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user