1616 * specific language governing permissions and limitations
1717 * under the License.
1818 */
19+
1920package org .apache .commons .csv ;
2021
2122import static org .junit .jupiter .api .Assertions .assertEquals ;
@@ -36,11 +37,16 @@ private Reader getTestInput(final String path) {
3637 @ Test
3738 public void testParseFourBytes () throws IOException {
3839 final CSVFormat format = CSVFormat .Builder .create ().setDelimiter (',' ).setQuote ('\'' ).get ();
39- try (CSVParser parser = new CSVParser .Builder ().setFormat (format ).setReader (getTestInput ("org/apache/commons/csv/CSV-196/emoji.csv" ))
40- .setCharset (StandardCharsets .UTF_8 ).setTrackBytes (true ).get ()) {
40+ // @formatter:off
41+ try (CSVParser parser = new CSVParser .Builder ()
42+ .setFormat (format )
43+ .setReader (getTestInput ("org/apache/commons/csv/CSV-196/emoji.csv" ))
44+ .setCharset (StandardCharsets .UTF_8 )
45+ .setTrackBytes (true ).get ()) {
46+ // @formatter:on
4147 final long [] charByteKey = { 0 , 84 , 701 , 1318 , 1935 };
4248 int idx = 0 ;
43- for (CSVRecord record : parser ) {
49+ for (final CSVRecord record : parser ) {
4450 assertEquals (charByteKey [idx ++], record .getBytePosition (), "index " + idx );
4551 }
4652 }
@@ -49,11 +55,16 @@ public void testParseFourBytes() throws IOException {
4955 @ Test
5056 public void testParseThreeBytes () throws IOException {
5157 final CSVFormat format = CSVFormat .Builder .create ().setDelimiter (',' ).setQuote ('\'' ).get ();
52- try (CSVParser parser = new CSVParser .Builder ().setFormat (format ).setReader (getTestInput ("org/apache/commons/csv/CSV-196/japanese.csv" ))
53- .setCharset (StandardCharsets .UTF_8 ).setTrackBytes (true ).get ()) {
58+ // @formatter:off
59+ try (CSVParser parser = new CSVParser .Builder ()
60+ .setFormat (format )
61+ .setReader (getTestInput ("org/apache/commons/csv/CSV-196/japanese.csv" ))
62+ .setCharset (StandardCharsets .UTF_8 )
63+ .setTrackBytes (true ).get ()) {
64+ // @formatter:on
5465 final long [] charByteKey = { 0 , 89 , 242 , 395 };
5566 int idx = 0 ;
56- for (CSVRecord record : parser ) {
67+ for (final CSVRecord record : parser ) {
5768 assertEquals (charByteKey [idx ++], record .getBytePosition (), "index " + idx );
5869 }
5970 }
0 commit comments