File tree Expand file tree Collapse file tree 3 files changed +6
-28
lines changed
src/test/java/org/apache/commons/io Expand file tree Collapse file tree 3 files changed +6
-28
lines changed Original file line number Diff line number Diff line change 3939
4040import org .apache .commons .io .CharsetsTest ;
4141import org .apache .commons .io .IOUtils ;
42+ import org .apache .commons .lang3 .StringUtils ;
4243import org .junit .jupiter .api .Test ;
4344import org .junit .jupiter .params .ParameterizedTest ;
4445import org .junit .jupiter .params .provider .MethodSource ;
@@ -48,17 +49,8 @@ class CharSequenceInputStreamTest {
4849 private static final String UTF_16 = StandardCharsets .UTF_16 .name ();
4950 private static final String UTF_8 = StandardCharsets .UTF_8 .name ();
5051 private static final String ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ;
51- private static final String LARGE_TEST_STRING ;
52-
5352 private static final String TEST_STRING = "\u00e0 peine arriv\u00e9 s nous entr\u00e2 mes dans sa chambre" ;
54-
55- static {
56- final StringBuilder buffer = new StringBuilder ();
57- for (int i = 0 ; i < 100 ; i ++) {
58- buffer .append (TEST_STRING );
59- }
60- LARGE_TEST_STRING = buffer .toString ();
61- }
53+ private static final String LARGE_TEST_STRING = StringUtils .repeat (TEST_STRING , 100 );
6254
6355 private final Random random = new Random ();
6456
Original file line number Diff line number Diff line change 3939import javax .xml .parsers .DocumentBuilderFactory ;
4040
4141import org .apache .commons .io .IOUtils ;
42+ import org .apache .commons .lang3 .StringUtils ;
4243import org .junit .jupiter .api .Test ;
4344import org .junit .jupiter .api .Timeout ;
4445import org .junit .jupiter .params .ParameterizedTest ;
@@ -52,15 +53,7 @@ class ReaderInputStreamTest {
5253 private static final String UTF_16 = StandardCharsets .UTF_16 .name ();
5354 private static final String UTF_8 = StandardCharsets .UTF_8 .name ();
5455 private static final String TEST_STRING = "\u00e0 peine arriv\u00e9 s nous entr\u00e2 mes dans sa chambre" ;
55- private static final String LARGE_TEST_STRING ;
56-
57- static {
58- final StringBuilder buffer = new StringBuilder ();
59- for (int i = 0 ; i < 100 ; i ++) {
60- buffer .append (TEST_STRING );
61- }
62- LARGE_TEST_STRING = buffer .toString ();
63- }
56+ private static final String LARGE_TEST_STRING = StringUtils .repeat (TEST_STRING , 100 );
6457
6558 static Stream <Arguments > charsetData () {
6659 // @formatter:off
Original file line number Diff line number Diff line change 2929
3030import org .apache .commons .io .Charsets ;
3131import org .apache .commons .io .charset .CharsetDecoders ;
32+ import org .apache .commons .lang3 .StringUtils ;
3233import org .apache .commons .lang3 .SystemProperties ;
3334import org .junit .jupiter .api .Test ;
3435
@@ -42,15 +43,7 @@ class WriterOutputStreamTest {
4243 private static final String UTF_16 = StandardCharsets .UTF_16 .name ();
4344 private static final String UTF_8 = StandardCharsets .UTF_8 .name ();
4445 private static final String TEST_STRING = "\u00e0 peine arriv\u00e9 s nous entr\u00e2 mes dans sa chambre" ;
45- private static final String LARGE_TEST_STRING ;
46-
47- static {
48- final StringBuilder buffer = new StringBuilder ();
49- for (int i = 0 ; i < 100 ; i ++) {
50- buffer .append (TEST_STRING );
51- }
52- LARGE_TEST_STRING = buffer .toString ();
53- }
46+ private static final String LARGE_TEST_STRING = StringUtils .repeat (TEST_STRING , 100 );
5447
5548 private final Random random = new Random ();
5649
You can’t perform that action at this time.
0 commit comments