No functional changes are contained in this commit: reformatted Java code to fix several formatting inconsistencies (between classes and within the same class); sorry for the big commit, but I have preferred to isolate into one commit all the formatting changes.

git-svn-id: https://svn.apache.org/repos/asf/commons/sandbox/csv/trunk@1065950 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacopo Cappellato 2011-02-01 08:46:00 +00:00
parent fe5bd51f8a
commit 1166ca605b
20 changed files with 2420 additions and 2246 deletions

View File

@ -51,20 +51,32 @@ import java.util.ArrayList;
*/
public class CSVParser {
/** length of the initial token (content-)buffer */
/**
* length of the initial token (content-)buffer
*/
private static final int INITIAL_TOKEN_LENGTH = 50;
// the token types
/** Token has no valid content, i.e. is in its initialized state. */
/**
* Token has no valid content, i.e. is in its initialized state.
*/
protected static final int TT_INVALID = -1;
/** Token with content, at beginning or in the middle of a line. */
/**
* Token with content, at beginning or in the middle of a line.
*/
protected static final int TT_TOKEN = 0;
/** Token (which can have content) when end of file is reached. */
/**
* Token (which can have content) when end of file is reached.
*/
protected static final int TT_EOF = 1;
/** Token with content when end of a line is reached. */
/**
* Token with content when end of a line is reached.
*/
protected static final int TT_EORECORD = 2;
/** Immutable empty String array. */
/**
* Immutable empty String array.
*/
private static final String[] EMPTY_STRING_ARRAY = new String[0];
// the input stream
@ -73,7 +85,9 @@ public class CSVParser {
private final CSVStrategy strategy;
// the following objects are shared to reduce garbage
/** A record buffer for getLine(). Grows as necessary and is reused. */
/**
* A record buffer for getLine(). Grows as necessary and is reused.
*/
private final ArrayList record = new ArrayList();
private final Token reusableToken = new Token();
private final CharBuffer wsBuf = new CharBuffer();
@ -82,15 +96,21 @@ public class CSVParser {
/**
* Token is an internal token representation.
*
* <p/>
* It is used as contract between the lexer and the parser.
*/
static class Token {
/** Token type, see TT_xxx constants. */
/**
* Token type, see TT_xxx constants.
*/
int type = TT_INVALID;
/** The content buffer. */
/**
* The content buffer.
*/
CharBuffer content = new CharBuffer(INITIAL_TOKEN_LENGTH);
/** Token ready flag: indicates a valid token with content (ready for the parser). */
/**
* Token ready flag: indicates a valid token with content (ready for the parser).
*/
boolean isReady;
Token reset() {
@ -126,7 +146,7 @@ public class CSVParser {
/**
* Customized value delimiter parser.
*
* <p/>
* The parser follows the default {@link CSVStrategy}
* except for the delimiter setting.
*
@ -140,7 +160,7 @@ public class CSVParser {
/**
* Customized csv parser.
*
* <p/>
* The parser parses according to the given CSV dialect settings.
* Leading whitespaces are truncated, unicode escapes are
* not interpreted and empty lines are ignored.
@ -174,7 +194,7 @@ public class CSVParser {
* Parses the CSV according to the given strategy
* and returns the content as an array of records
* (whereas records are arrays of single values).
* <p>
* <p/>
* The returned content starts at the current parse-position in
* the stream.
*
@ -270,7 +290,7 @@ public class CSVParser {
/**
* Returns the current line number in the input stream.
*
* <p/>
* ATTENTION: in case your csv has multiline-values the returned
* number does not correspond to the record-number
*
@ -293,7 +313,7 @@ public class CSVParser {
/**
* Returns the next token.
*
* <p/>
* A token corresponds to a term, a record change or an
* end-of-file indicator.
*
@ -386,7 +406,7 @@ public class CSVParser {
/**
* A simple token lexer
*
* <p/>
* Simple token are tokens which are not surrounded by encapsulators.
* A simple token might contain escaped delimiters (as \, or \;). The
* token is finished when one of the following conditions become true:
@ -399,7 +419,6 @@ public class CSVParser {
* @param tkn the current token
* @param c the current character
* @return the filled token
*
* @throws IOException on stream access error
*/
private Token simpleTokenLexer(Token tkn, int c) throws IOException {
@ -441,7 +460,7 @@ public class CSVParser {
/**
* An encapsulated token lexer
*
* <p/>
* Encapsulated tokens are surrounded by the given encapsulating-string.
* The encapsulator itself might be included in the token using a
* doubling syntax (as "", '') or using escaping (as in \", \').
@ -511,9 +530,10 @@ public class CSVParser {
/**
* Decodes Unicode escapes.
*
* <p/>
* Interpretation of "\\uXXXX" escape sequences
* where XXXX is a hex-number.
*
* @param c current char which is discarded because it's the "\\" of "\\uXXXX"
* @return the decoded character
* @throws IOException on wrong unicode escape sequence or read error
@ -545,12 +565,23 @@ public class CSVParser {
c = in.read();
int out;
switch (c) {
case 'r': out='\r'; break;
case 'n': out='\n'; break;
case 't': out='\t'; break;
case 'b': out='\b'; break;
case 'f': out='\f'; break;
default : out=c;
case 'r':
out = '\r';
break;
case 'n':
out = '\n';
break;
case 't':
out = '\t';
break;
case 'b':
out = '\b';
break;
case 'f':
out = '\f';
break;
default:
out = c;
}
return out;
}

View File

@ -26,11 +26,15 @@ import java.io.Writer;
*/
public class CSVPrinter {
/** The place that the values get written. */
/**
* The place that the values get written.
*/
protected final Writer out;
protected final CSVStrategy strategy;
/** True if we just began a new line. */
/**
* True if we just began a new line.
*/
protected boolean newLine = true;
protected char[] buf = new char[0]; // temporary buffer
@ -38,7 +42,7 @@ public class CSVPrinter {
/**
* Create a printer that will print values to the given
* stream following the CSVStrategy.
*
* <p/>
* Currently, only a pure encapsulation strategy or a pure escaping strategy
* is supported. Hybrid strategies (encapsulation and escaping with a different character) are not supported.
*
@ -165,8 +169,11 @@ public class CSVPrinter {
if (l > 0) {
out.write(value, start, l);
}
if (c=='\n') c='n';
else if (c=='\r') c='r';
if (c == '\n') {
c = 'n';
} else if (c == '\r') {
c = 'r';
}
out.write(escape);
out.write(c);

View File

@ -80,8 +80,7 @@ public class CSVStrategy implements Cloneable, Serializable {
boolean ignoreLeadingWhitespace,
boolean ignoreTrailingWhitespace,
boolean interpretUnicodeEscapes,
boolean ignoreEmptyLines)
{
boolean ignoreEmptyLines) {
setDelimiter(delimiter);
setEncapsulator(encapsulator);
setCommentStart(commentStart);
@ -92,53 +91,92 @@ public class CSVStrategy implements Cloneable, Serializable {
setIgnoreEmptyLines(ignoreEmptyLines);
}
/** @deprecated */
/**
* @deprecated
*/
public CSVStrategy(
char delimiter,
char encapsulator,
char commentStart,
boolean ignoreLeadingWhitespace,
boolean interpretUnicodeEscapes,
boolean ignoreEmptyLines)
{
boolean ignoreEmptyLines) {
this(delimiter, encapsulator, commentStart, CSVStrategy.ESCAPE_DISABLED, ignoreLeadingWhitespace,
true, interpretUnicodeEscapes, ignoreEmptyLines);
}
public void setDelimiter(char delimiter) { this.delimiter = delimiter; }
public char getDelimiter() { return this.delimiter; }
public void setDelimiter(char delimiter) {
this.delimiter = delimiter;
}
public void setEncapsulator(char encapsulator) { this.encapsulator = encapsulator; }
public char getEncapsulator() { return this.encapsulator; }
public char getDelimiter() {
return this.delimiter;
}
public void setCommentStart(char commentStart) { this.commentStart = commentStart; }
public char getCommentStart() { return this.commentStart; }
public boolean isCommentingDisabled() { return this.commentStart == COMMENTS_DISABLED; }
public void setEncapsulator(char encapsulator) {
this.encapsulator = encapsulator;
}
public void setEscape(char escape) { this.escape = escape; }
public char getEscape() { return this.escape; }
public char getEncapsulator() {
return this.encapsulator;
}
public void setCommentStart(char commentStart) {
this.commentStart = commentStart;
}
public char getCommentStart() {
return this.commentStart;
}
public boolean isCommentingDisabled() {
return this.commentStart == COMMENTS_DISABLED;
}
public void setEscape(char escape) {
this.escape = escape;
}
public char getEscape() {
return this.escape;
}
public void setIgnoreLeadingWhitespaces(boolean ignoreLeadingWhitespaces) {
this.ignoreLeadingWhitespaces = ignoreLeadingWhitespaces;
}
public boolean getIgnoreLeadingWhitespaces() { return this.ignoreLeadingWhitespaces; }
public boolean getIgnoreLeadingWhitespaces() {
return this.ignoreLeadingWhitespaces;
}
public void setIgnoreTrailingWhitespaces(boolean ignoreTrailingWhitespaces) {
this.ignoreTrailingWhitespaces = ignoreTrailingWhitespaces;
}
public boolean getIgnoreTrailingWhitespaces() { return this.ignoreTrailingWhitespaces; }
public boolean getIgnoreTrailingWhitespaces() {
return this.ignoreTrailingWhitespaces;
}
public void setUnicodeEscapeInterpretation(boolean interpretUnicodeEscapes) {
this.interpretUnicodeEscapes = interpretUnicodeEscapes;
}
public boolean getUnicodeEscapeInterpretation() { return this.interpretUnicodeEscapes; }
public void setIgnoreEmptyLines(boolean ignoreEmptyLines) { this.ignoreEmptyLines = ignoreEmptyLines; }
public boolean getIgnoreEmptyLines() { return this.ignoreEmptyLines; }
public boolean getUnicodeEscapeInterpretation() {
return this.interpretUnicodeEscapes;
}
public void setIgnoreEmptyLines(boolean ignoreEmptyLines) {
this.ignoreEmptyLines = ignoreEmptyLines;
}
public boolean getIgnoreEmptyLines() {
return this.ignoreEmptyLines;
}
public void setPrinterNewline(String newline) {
this.printerNewline = newline;
}
public String getPrinterNewline() {
return this.printerNewline;
}

View File

@ -64,6 +64,7 @@ public class CharBuffer {
/**
* Returns the number of characters in the buffer.
*
* @return the number of characters
*/
public int length() {
@ -72,6 +73,7 @@ public class CharBuffer {
/**
* Returns the current capacity of the buffer.
*
* @return the maximum number of characters that can be stored in this buffer without
* resizing it.
*/
@ -82,6 +84,7 @@ public class CharBuffer {
/**
* Appends the contents of <code>cb</code> to the end of this CharBuffer.
*
* @param cb the CharBuffer to append or null
*/
public void append(final CharBuffer cb) {
@ -96,6 +99,7 @@ public class CharBuffer {
/**
* Appends <code>s</code> to the end of this CharBuffer.
* This method involves copying the new data once!
*
* @param s the String to append or null
*/
public void append(final String s) {
@ -108,6 +112,7 @@ public class CharBuffer {
/**
* Appends <code>sb</code> to the end of this CharBuffer.
* This method involves copying the new data once!
*
* @param sb the StringBuffer to append or null
*/
public void append(final StringBuffer sb) {
@ -122,6 +127,7 @@ public class CharBuffer {
/**
* Appends <code>data</code> to the end of this CharBuffer.
* This method involves copying the new data once!
*
* @param data the char[] to append or null
*/
public void append(final char[] data) {
@ -136,6 +142,7 @@ public class CharBuffer {
/**
* Appends a single character to the end of this CharBuffer.
* This method involves copying the new data once!
*
* @param data the char to append
*/
public void append(final char data) {
@ -172,6 +179,7 @@ public class CharBuffer {
* modifying it.
* This method allows to avoid copying if the caller knows the exact capacity
* before.
*
* @return
*/
public char[] getCharacters() {
@ -193,6 +201,7 @@ public class CharBuffer {
/**
* Converts the contents of the buffer into a StringBuffer.
* This method involves copying the new data once!
*
* @return
*/
public StringBuffer toStringBuffer() {
@ -204,6 +213,7 @@ public class CharBuffer {
/**
* Converts the contents of the buffer into a StringBuffer.
* This method involves copying the new data once!
*
* @return
*/
public String toString() {
@ -212,6 +222,7 @@ public class CharBuffer {
/**
* Copies the data into a new array of at least <code>capacity</code> size.
*
* @param capacity
*/
public void provideCapacity(final int capacity) {

View File

@ -23,33 +23,41 @@ import java.io.Reader;
/**
* ExtendedBufferedReader
*
* A special reader decorater which supports more
* A special reader decorator which supports more
* sophisticated access to the underlying reader object.
*
* In particular the reader supports a look-ahead option,
* which allows you to see the next char returned by
* next().
*
*/
class ExtendedBufferedReader extends BufferedReader {
/** the end of stream symbol */
/**
* the end of stream symbol
*/
public static final int END_OF_STREAM = -1;
/** undefined state for the lookahead char */
/**
* undefined state for the lookahead char
*/
public static final int UNDEFINED = -2;
/** the lookahead chars */
/**
* the lookahead chars
*/
private int lookaheadChar = UNDEFINED;
/** the last char returned */
/**
* the last char returned
*/
private int lastChar = UNDEFINED;
/** the line counter */
/**
* the line counter
*/
private int lineCounter = 0;
private CharBuffer line = new CharBuffer();
/**
* Created extended buffered reader using default buffer-size
*
*/
public ExtendedBufferedReader(Reader r) {
super(r);
@ -70,10 +78,11 @@ class ExtendedBufferedReader extends BufferedReader {
/**
* Reads the next char from the input stream.
*
* @return the next char or END_OF_STREAM if end of stream has been reached.
*/
public int read() throws IOException {
// initalize the lookahead
// initialize the lookahead
if (lookaheadChar == UNDEFINED) {
lookaheadChar = super.read();
}
@ -101,8 +110,8 @@ class ExtendedBufferedReader extends BufferedReader {
/**
* Non-blocking reading of len chars into buffer buf starting
* at bufferposition off.
*
* performs an iteratative read on the underlying stream
* <p/>
* performs an iterative read on the underlying stream
* as long as the following conditions hold:
* - less than len chars have been read
* - end of stream has not been reached

View File

@ -32,36 +32,65 @@ import java.util.List;
*/
public class CSVConfig {
/** specifies if it is a fixed width csv file **/
/**
* specifies if it is a fixed width csv file *
*/
private boolean fixedWidth;
/** list of fields **/
/**
* list of fields *
*/
private List fields;
/** Do no do any filling **/
/**
* Do no do any filling *
*/
public static final int FILLNONE = 0;
/** Fill content the the left. Mainly usable together with fixedWidth **/
/**
* Fill content the the left. Mainly usable together with fixedWidth *
*/
public static final int FILLLEFT = 1;
/** Fill content to the right. Mainly usable together with fixedWidth **/
/**
* Fill content to the right. Mainly usable together with fixedWidth *
*/
public static final int FILLRIGHT = 2;
/** The fill pattern */
/**
* The fill pattern
*/
private int fill;
/** The fill char. Defaults to a space */
/**
* The fill char. Defaults to a space
*/
private char fillChar = ' ';
/** The seperator character. Defaults to , */
/**
* The seperator character. Defaults to ,
*/
private char delimiter = ',';
/** The row separator. Defaults to \n */
/**
* The row separator. Defaults to \n
*/
private String rowDelimiter = "\n";
/** Should we ignore the delimiter. Defaults to false */
/**
* Should we ignore the delimiter. Defaults to false
*/
private boolean ignoreDelimiter = false;
/** the value delimiter. Defaults to " */
/**
* the value delimiter. Defaults to "
*/
private char valueDelimiter = '"';
/** Should we ignore the value delimiter. Defaults to true */
/**
* Should we ignore the value delimiter. Defaults to true
*/
private boolean ignoreValueDelimiter = true;
/** Specifies if we want to use a field header */
/**
* Specifies if we want to use a field header
*/
private boolean fieldHeader = false;
/** Specifies if the end of the line needs to be trimmed */
/**
* Specifies if the end of the line needs to be trimmed
*/
private boolean endTrimmed = false;
/**
*
*/
@ -79,6 +108,7 @@ public class CSVConfig {
/**
* Specify if the CSV file is fixed width.
* Defaults to false
*
* @param fixedWidth the fixedwidth
*/
public void setFixedWidth(boolean fixedWidth) {
@ -95,6 +125,7 @@ public class CSVConfig {
/**
* Set the fields that should be used by the writer.
* This will overwrite currently added fields completely!
*
* @param csvFields the csvfields array. If null it will do nothing
*/
public void setFields(CSVField[] csvFields) {
@ -106,6 +137,7 @@ public class CSVConfig {
/**
* Set the fields that should be used by the writer
*
* @param csvField a collection with fields. If null it will do nothing
*/
public void setFields(Collection csvField) {
@ -149,6 +181,7 @@ public class CSVConfig {
/**
* Set the fill pattern. Defaults to {@link #FILLNONE}
* <br/>Other options are : {@link #FILLLEFT} and {@link #FILLRIGHT}
*
* @param fill the fill pattern.
*/
public void setFill(int fill) {
@ -156,7 +189,6 @@ public class CSVConfig {
}
/**
*
* @return the fillchar. Defaults to a space.
*/
public char getFillChar() {
@ -165,6 +197,7 @@ public class CSVConfig {
/**
* Set the fill char
*
* @param fillChar the fill char
*/
public void setFillChar(char fillChar) {
@ -180,6 +213,7 @@ public class CSVConfig {
/**
* Set the delimiter to use
*
* @param delimiter the delimiter character.
*/
public void setDelimiter(char delimiter) {
@ -195,6 +229,7 @@ public class CSVConfig {
/**
* Set the rowDelimiter to use
*
* @param rowDelimiter the row delimiter character.
*/
public void setRowDelimiter(String rowDelimiter) {
@ -210,6 +245,7 @@ public class CSVConfig {
/**
* Specify if the writer should ignore the delimiter.
*
* @param ignoreDelimiter defaults to false.
*/
public void setIgnoreDelimiter(boolean ignoreDelimiter) {
@ -225,6 +261,7 @@ public class CSVConfig {
/**
* Set the value delimiter to use
*
* @param valueDelimiter the value delimiter character.
*/
public void setValueDelimiter(char valueDelimiter) {
@ -241,6 +278,7 @@ public class CSVConfig {
/**
* Specify if the writer should ignore the value delimiter.
*
* @param ignoreValueDelimiter defaults to false.
*/
public void setIgnoreValueDelimiter(boolean ignoreValueDelimiter) {
@ -253,8 +291,10 @@ public class CSVConfig {
public boolean isFieldHeader() {
return fieldHeader;
}
/**
* Specify if you want to use a field header.
*
* @param fieldHeader true or false.
*/
public void setFieldHeader(boolean fieldHeader) {
@ -263,6 +303,7 @@ public class CSVConfig {
/**
* TODO..
*
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
@ -278,6 +319,7 @@ public class CSVConfig {
/**
* Creates a config based on a stream. It tries to guess<br/>
* NOTE : The stream will be closed.
*
* @param inputStream the inputstream.
* @return the guessed config.
*/
@ -294,6 +336,7 @@ public class CSVConfig {
/**
* Specify if the end of the line needs to be trimmed. Defaults to false.
*
* @param endTrimmed
*/
public void setEndTrimmed(boolean endTrimmed) {

View File

@ -30,14 +30,18 @@ import java.io.InputStreamReader;
*/
public class CSVConfigGuesser {
/** The stream to read */
/**
* The stream to read
*/
private InputStream in;
/**
* if the file has a field header (need this info, to be able to guess better)
* Defaults to false
*/
private boolean hasFieldHeader = false;
/** The found config */
/**
* The found config
*/
protected CSVConfig config;
/**
@ -61,6 +65,7 @@ public class CSVConfigGuesser {
/**
* Allow override.
*
* @return the inputstream that was set.
*/
protected InputStream getInputStream() {
@ -116,6 +121,7 @@ public class CSVConfigGuesser {
/**
* Guess if this file is fixedwidth.
* Just basing the fact on all lines being of the same length
*
* @param lines
*/
protected void guessFixedWidth(String[] lines) {
@ -169,8 +175,8 @@ public class CSVConfigGuesser {
}
}
}
/**
*
* @return if the field uses a field header. Defaults to false.
*/
public boolean hasFieldHeader() {
@ -179,6 +185,7 @@ public class CSVConfigGuesser {
/**
* Specify if the CSV file has a field header
*
* @param hasFieldHeader true or false
*/
public void setHasFieldHeader(boolean hasFieldHeader) {

View File

@ -20,7 +20,6 @@ package org.apache.commons.csv.writer;
/**
*
* @author Martin van den Bemt
* @version $Id: $
*/
@ -62,6 +61,7 @@ public class CSVField {
/**
* Set the name of the field
*
* @param name the name
*/
public void setName(String name) {
@ -69,7 +69,6 @@ public class CSVField {
}
/**
*
* @return the size of the field
*/
public int getSize() {
@ -79,6 +78,7 @@ public class CSVField {
/**
* Set the size of the field.
* The size will be ignored when fixedwidth is set to false in the CSVConfig
*
* @param size the size of the field.
*/
public void setSize(int size) {
@ -94,6 +94,7 @@ public class CSVField {
/**
* Sets overrideFill to true.
*
* @param fill the file pattern
*/
public void setFill(int fill) {

View File

@ -31,10 +31,15 @@ import java.util.Map;
*/
public class CSVWriter {
/** The CSV config **/
/**
* The CSV config *
*/
private CSVConfig config;
/** The writer **/
/**
* The writer *
*/
private Writer writer;
/**
*
*/
@ -120,6 +125,7 @@ public class CSVWriter {
/**
* Set the CSVConfig
*
* @param config the CVSConfig
*/
public void setConfig(CSVConfig config) {
@ -128,6 +134,7 @@ public class CSVWriter {
/**
* Set the writer to write the CSV file to.
*
* @param writer the writer.
*/
public void setWriter(Writer writer) {

View File

@ -40,6 +40,7 @@ public class CSVParserTest extends TestCase {
class TestCSVParser extends CSVParser {
/**
* Test parser to investigate the type of the internal Token.
*
* @param in a Reader
*/
TestCSVParser(Reader in) {
@ -49,9 +50,11 @@ public class CSVParserTest extends TestCase {
TestCSVParser(Reader in, CSVStrategy strategy) {
super(in, strategy);
}
/**
* Calls super.nextToken() and prints out a String representation of token
* type and content.
*
* @return String representation of token type and content
* @throws IOException like {@link CSVParser#nextToken()}
*/
@ -206,6 +209,7 @@ public class CSVParserTest extends TestCase {
{"foo baar", "b", ""},
{"foo\n,,\n\",,\n\"", "d", "e"}
};
public void testGetLine() throws IOException {
CSVParser parser = new CSVParser(new StringReader(code));
String[] tmp = null;

View File

@ -106,7 +106,6 @@ public class CSVPrinterTest extends TestCase {
}
public void testRandom() throws Exception {
int iter = 10000;
strategy = CSVStrategy.DEFAULT_STRATEGY;
@ -209,16 +208,36 @@ public class CSVPrinterTest extends TestCase {
char ch;
int what = r.nextInt(20);
switch (what) {
case 0: ch = '\r'; break;
case 1: ch = '\n'; break;
case 2: ch = '\t'; break;
case 3: ch = '\f'; break;
case 4: ch = ' '; break;
case 5: ch = ','; break;
case 6: ch = '"'; break;
case 7: ch = '\''; break;
case 8: ch = '\\'; break;
default: ch = (char)r.nextInt(300); break;
case 0:
ch = '\r';
break;
case 1:
ch = '\n';
break;
case 2:
ch = '\t';
break;
case 3:
ch = '\f';
break;
case 4:
ch = ' ';
break;
case 5:
ch = ',';
break;
case 6:
ch = '"';
break;
case 7:
ch = '\'';
break;
case 8:
ch = '\\';
break;
default:
ch = (char) r.nextInt(300);
break;
// default: ch = 'a'; break;
}
buf[i] = ch;

View File

@ -21,7 +21,6 @@ package org.apache.commons.csv;
import junit.framework.TestCase;
/**
*
* @author Ortwin Glück
*/
public class CharBufferTest extends TestCase {

View File

@ -25,7 +25,6 @@ import junit.framework.TestSuite;
/**
* ExtendedBufferedReaderTest
*
*/
public class ExtendedBufferedReaderTest extends TestCase {

View File

@ -41,10 +41,10 @@ public class CSVConfigGuesserTest extends TestCase {
guesser.setHasFieldHeader(true);
assertEquals(true, guesser.hasFieldHeader());
}
/**
* Test a format like
* 1234 ; abcd ; 1234 ;
*
*/
public void testConfigGuess1() {
CSVConfig expected = new CSVConfig();
@ -67,11 +67,11 @@ public class CSVConfigGuesserTest extends TestCase {
assertEquals(expected.getFields().length, guessed.getFields().length);
assertEquals(expected.getFields()[0].getSize(), guessed.getFields()[0].getSize());
}
/**
* Test a format like
* 1234,123123,12312312,213123
* 1,2,3,4
*
*/
public void testConfigGuess2() {
CSVConfig expected = new CSVConfig();

View File

@ -21,7 +21,6 @@ package org.apache.commons.csv.writer;
import junit.framework.TestCase;
/**
*
* @author Martin van den Bemt
* @version $Id: $
*/