Improve String concatenation where appropriate
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2023 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.
|
||||
@@ -38,13 +38,13 @@ public class OrderLineAggregator implements LineAggregator<Order> {
|
||||
public String aggregate(Order order) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
||||
result.append(aggregators.get("header").aggregate(order) + LINE_SEPARATOR);
|
||||
result.append(aggregators.get("customer").aggregate(order) + LINE_SEPARATOR);
|
||||
result.append(aggregators.get("address").aggregate(order) + LINE_SEPARATOR);
|
||||
result.append(aggregators.get("billing").aggregate(order) + LINE_SEPARATOR);
|
||||
result.append(aggregators.get("header").aggregate(order)).append(LINE_SEPARATOR);
|
||||
result.append(aggregators.get("customer").aggregate(order)).append(LINE_SEPARATOR);
|
||||
result.append(aggregators.get("address").aggregate(order)).append(LINE_SEPARATOR);
|
||||
result.append(aggregators.get("billing").aggregate(order)).append(LINE_SEPARATOR);
|
||||
|
||||
for (LineItem lineItem : order.getLineItems()) {
|
||||
result.append(aggregators.get("item").aggregate(lineItem) + LINE_SEPARATOR);
|
||||
result.append(aggregators.get("item").aggregate(lineItem)).append(LINE_SEPARATOR);
|
||||
}
|
||||
|
||||
result.append(aggregators.get("footer").aggregate(order));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008-2022 the original author or authors.
|
||||
* Copyright 2008-2023 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.
|
||||
@@ -106,12 +106,12 @@ class CompositeItemWriterSampleFunctionalTests {
|
||||
private void checkOutputFile(String fileName) throws IOException {
|
||||
List<String> outputLines = IOUtils.readLines(new FileInputStream(fileName), "UTF-8");
|
||||
|
||||
String output = "";
|
||||
StringBuilder output = new StringBuilder();
|
||||
for (String line : outputLines) {
|
||||
output += line;
|
||||
output.append(line);
|
||||
}
|
||||
|
||||
assertEquals(EXPECTED_OUTPUT_FILE, output);
|
||||
assertEquals(EXPECTED_OUTPUT_FILE, output.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user