This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-csv.git
The following commit(s) were added to refs/heads/master by this push:
new 7a264a24 Use final
7a264a24 is described below
commit 7a264a24fc6ee4b3f717d0e799b893b7f7f30fbd
Author: Gary Gregory <[email protected]>
AuthorDate: Fri Jun 6 09:22:34 2025 -0400
Use final
Format
---
.../org/apache/commons/csv/JiraCsv196Test.java | 23 ++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/src/test/java/org/apache/commons/csv/JiraCsv196Test.java
b/src/test/java/org/apache/commons/csv/JiraCsv196Test.java
index cff3a772..3b6c7401 100644
--- a/src/test/java/org/apache/commons/csv/JiraCsv196Test.java
+++ b/src/test/java/org/apache/commons/csv/JiraCsv196Test.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.commons.csv;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -36,11 +37,16 @@ public class JiraCsv196Test {
@Test
public void testParseFourBytes() throws IOException {
final CSVFormat format =
CSVFormat.Builder.create().setDelimiter(',').setQuote('\'').get();
- try (CSVParser parser = new
CSVParser.Builder().setFormat(format).setReader(getTestInput("org/apache/commons/csv/CSV-196/emoji.csv"))
- .setCharset(StandardCharsets.UTF_8).setTrackBytes(true).get())
{
+ // @formatter:off
+ try (CSVParser parser = new CSVParser.Builder()
+ .setFormat(format)
+
.setReader(getTestInput("org/apache/commons/csv/CSV-196/emoji.csv"))
+ .setCharset(StandardCharsets.UTF_8)
+ .setTrackBytes(true).get()) {
+ // @formatter:on
final long[] charByteKey = { 0, 84, 701, 1318, 1935 };
int idx = 0;
- for (CSVRecord record : parser) {
+ for (final CSVRecord record : parser) {
assertEquals(charByteKey[idx++], record.getBytePosition(),
"index " + idx);
}
}
@@ -49,11 +55,16 @@ public class JiraCsv196Test {
@Test
public void testParseThreeBytes() throws IOException {
final CSVFormat format =
CSVFormat.Builder.create().setDelimiter(',').setQuote('\'').get();
- try (CSVParser parser = new
CSVParser.Builder().setFormat(format).setReader(getTestInput("org/apache/commons/csv/CSV-196/japanese.csv"))
- .setCharset(StandardCharsets.UTF_8).setTrackBytes(true).get())
{
+ // @formatter:off
+ try (CSVParser parser = new CSVParser.Builder()
+ .setFormat(format)
+
.setReader(getTestInput("org/apache/commons/csv/CSV-196/japanese.csv"))
+ .setCharset(StandardCharsets.UTF_8)
+ .setTrackBytes(true).get()) {
+ // @formatter:on
final long[] charByteKey = { 0, 89, 242, 395 };
int idx = 0;
- for (CSVRecord record : parser) {
+ for (final CSVRecord record : parser) {
assertEquals(charByteKey[idx++], record.getBytePosition(),
"index " + idx);
}
}