Remove unnecessary array creation for varargs.
This commit is contained in:
parent
06dda31f52
commit
5e9216d331
|
@ -296,12 +296,12 @@ public class CSVParserTest {
|
|||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> CSVParser.parse("a,b,a\n1,2,3\nx,y,z",
|
||||
CSVFormat.DEFAULT.withHeader(new String[] {}).withAllowDuplicateHeaderNames(false)));
|
||||
CSVFormat.DEFAULT.withHeader().withAllowDuplicateHeaderNames(false)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDuplicateHeadersAllowedByDefault() throws Exception {
|
||||
CSVParser.parse("a,b,a\n1,2,3\nx,y,z", CSVFormat.DEFAULT.withHeader(new String[] {}));
|
||||
CSVParser.parse("a,b,a\n1,2,3\nx,y,z", CSVFormat.DEFAULT.withHeader());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -264,7 +264,7 @@ public class PerformanceTest {
|
|||
private static Constructor<Lexer> getLexerCtor(final String clazz) throws Exception {
|
||||
@SuppressWarnings("unchecked")
|
||||
final Class<Lexer> lexer = (Class<Lexer>) Class.forName("org.apache.commons.csv." + clazz);
|
||||
return lexer.getConstructor(new Class<?>[]{CSVFormat.class, ExtendedBufferedReader.class});
|
||||
return lexer.getConstructor(CSVFormat.class, ExtendedBufferedReader.class);
|
||||
}
|
||||
|
||||
private static void testCSVLexer(final boolean newToken, final String test) throws Exception {
|
||||
|
@ -317,8 +317,7 @@ public class PerformanceTest {
|
|||
|
||||
private static Lexer createTestCSVLexer(final String test, final ExtendedBufferedReader input)
|
||||
throws InstantiationException, IllegalAccessException, InvocationTargetException, Exception {
|
||||
return test.startsWith("CSVLexer") ? getLexerCtor(test)
|
||||
.newInstance(new Object[] { format, input }) : new Lexer(format, input);
|
||||
return test.startsWith("CSVLexer") ? getLexerCtor(test).newInstance(format, input) : new Lexer(format, input);
|
||||
}
|
||||
|
||||
private static Stats iterate(final Iterable<CSVRecord> it) {
|
||||
|
|
|
@ -37,7 +37,7 @@ public class JiraCsv203Test {
|
|||
|
||||
final StringBuffer buffer = new StringBuffer();
|
||||
try (final CSVPrinter printer = new CSVPrinter(buffer, format)) {
|
||||
printer.printRecord(new Object[] { null, "Hello", null, "World" });
|
||||
printer.printRecord(null, "Hello", null, "World");
|
||||
}
|
||||
assertEquals("\"N/A\",\"Hello\",\"N/A\",\"World\"\r\n", buffer.toString());
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class JiraCsv203Test {
|
|||
|
||||
final StringBuffer buffer = new StringBuffer();
|
||||
try (final CSVPrinter printer = new CSVPrinter(buffer, format)) {
|
||||
printer.printRecord(new Object[] { null, "Hello", null, "World" });
|
||||
printer.printRecord(null, "Hello", null, "World");
|
||||
}
|
||||
assertEquals("N/A,\"Hello\",N/A,\"World\"\r\n", buffer.toString());
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public class JiraCsv203Test {
|
|||
|
||||
final StringBuffer buffer = new StringBuffer();
|
||||
try (final CSVPrinter printer = new CSVPrinter(buffer, format)) {
|
||||
printer.printRecord(new Object[] { null, "Hello", null, "World" });
|
||||
printer.printRecord(null, "Hello", null, "World");
|
||||
}
|
||||
assertEquals("N/A,Hello,N/A,World\r\n", buffer.toString());
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public class JiraCsv203Test {
|
|||
|
||||
final StringBuffer buffer = new StringBuffer();
|
||||
try (final CSVPrinter printer = new CSVPrinter(buffer, format)) {
|
||||
printer.printRecord(new Object[] { null, "Hello", null, "World" });
|
||||
printer.printRecord(null, "Hello", null, "World");
|
||||
}
|
||||
assertEquals("N/A,Hello,N/A,World\r\n", buffer.toString());
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public class JiraCsv203Test {
|
|||
|
||||
final StringBuffer buffer = new StringBuffer();
|
||||
try (final CSVPrinter printer = new CSVPrinter(buffer, format)) {
|
||||
printer.printRecord(new Object[] { null, "Hello", null, "World" });
|
||||
printer.printRecord(null, "Hello", null, "World");
|
||||
}
|
||||
assertEquals("N/A,\"Hello\",N/A,\"World\"\r\n", buffer.toString());
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ public class JiraCsv203Test {
|
|||
|
||||
final StringBuffer buffer = new StringBuffer();
|
||||
try (final CSVPrinter printer = new CSVPrinter(buffer, format)) {
|
||||
printer.printRecord(new Object[] { null, "Hello", null, "World" });
|
||||
printer.printRecord(null, "Hello", null, "World");
|
||||
}
|
||||
assertEquals(",\"Hello\",,\"World\"\r\n", buffer.toString());
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ public class JiraCsv203Test {
|
|||
|
||||
final StringBuffer buffer = new StringBuffer();
|
||||
try (final CSVPrinter printer = new CSVPrinter(buffer, format)) {
|
||||
printer.printRecord(new Object[] { "", "Hello", "", "World" });
|
||||
printer.printRecord("", "Hello", "", "World");
|
||||
//printer.printRecord(new Object[] { null, "Hello", null, "World" });
|
||||
}
|
||||
assertEquals("\"\",\"Hello\",\"\",\"World\"\r\n", buffer.toString());
|
||||
|
|
Loading…
Reference in New Issue