Skip to content

Commit a34ceda

Browse files
committed
Use varargs.
1 parent d400a04 commit a34ceda

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/test/java/org/apache/commons/csv/CSVFormatTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,28 +166,28 @@ public void testEqualsHash() throws Exception {
166166
for (final Class<?> cls : method.getParameterTypes()) {
167167
final String type = cls.getCanonicalName();
168168
if ("boolean".equals(type)) {
169-
final Object defTrue = method.invoke(CSVFormat.DEFAULT, new Object[] {Boolean.TRUE});
170-
final Object defFalse = method.invoke(CSVFormat.DEFAULT, new Object[] {Boolean.FALSE});
169+
final Object defTrue = method.invoke(CSVFormat.DEFAULT, Boolean.TRUE);
170+
final Object defFalse = method.invoke(CSVFormat.DEFAULT, Boolean.FALSE);
171171
assertNotEquals(name, type ,defTrue, defFalse);
172172
} else if ("char".equals(type)){
173-
final Object a = method.invoke(CSVFormat.DEFAULT, new Object[] {'a'});
174-
final Object b = method.invoke(CSVFormat.DEFAULT, new Object[] {'b'});
173+
final Object a = method.invoke(CSVFormat.DEFAULT, 'a');
174+
final Object b = method.invoke(CSVFormat.DEFAULT, 'b');
175175
assertNotEquals(name, type, a, b);
176176
} else if ("java.lang.Character".equals(type)){
177177
final Object a = method.invoke(CSVFormat.DEFAULT, new Object[] {null});
178-
final Object b = method.invoke(CSVFormat.DEFAULT, new Object[] {new Character('d')});
178+
final Object b = method.invoke(CSVFormat.DEFAULT, new Character('d'));
179179
assertNotEquals(name, type, a, b);
180180
} else if ("java.lang.String".equals(type)){
181181
final Object a = method.invoke(CSVFormat.DEFAULT, new Object[] {null});
182-
final Object b = method.invoke(CSVFormat.DEFAULT, new Object[] {"e"});
182+
final Object b = method.invoke(CSVFormat.DEFAULT, "e");
183183
assertNotEquals(name, type, a, b);
184184
} else if ("java.lang.String[]".equals(type)){
185185
final Object a = method.invoke(CSVFormat.DEFAULT, new Object[] {new String[] {null, null}});
186186
final Object b = method.invoke(CSVFormat.DEFAULT, new Object[] {new String[] {"f", "g"}});
187187
assertNotEquals(name, type, a, b);
188188
} else if ("org.apache.commons.csv.QuoteMode".equals(type)){
189-
final Object a = method.invoke(CSVFormat.DEFAULT, new Object[] {QuoteMode.MINIMAL});
190-
final Object b = method.invoke(CSVFormat.DEFAULT, new Object[] {QuoteMode.ALL});
189+
final Object a = method.invoke(CSVFormat.DEFAULT, QuoteMode.MINIMAL);
190+
final Object b = method.invoke(CSVFormat.DEFAULT, QuoteMode.ALL);
191191
assertNotEquals(name, type, a, b);
192192
} else if ("java.lang.Object[]".equals(type)){
193193
final Object a = method.invoke(CSVFormat.DEFAULT, new Object[] {new Object[] {null, null}});

src/test/java/org/apache/commons/csv/CSVPrinterTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ public void testExcelPrintAllIterableOfLists() throws IOException {
547547
final StringWriter sw = new StringWriter();
548548
try (final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL)) {
549549
printer.printRecords(
550-
Arrays.asList(new List[] { Arrays.asList("r1c1", "r1c2"), Arrays.asList("r2c1", "r2c2") }));
550+
Arrays.asList(Arrays.asList("r1c1", "r1c2"), Arrays.asList("r2c1", "r2c2")));
551551
assertEquals("r1c1,r1c2" + recordSeparator + "r2c1,r2c2" + recordSeparator, sw.toString());
552552
}
553553
}

0 commit comments

Comments
 (0)