au.com.bytecode.opencsv
Class CSVParserTest
java.lang.Object
au.com.bytecode.opencsv.CSVParserTest
public class CSVParserTest
- extends Object
|
Method Summary |
void |
anIOExceptionThrownifStringEndsInsideAQuotedString()
|
void |
parseEmptyElements()
|
void |
parseLineMultiAllowsQuotesAcrossMultipleLines()
|
void |
parseMultiLinedQuoted()
|
void |
parseMultipleQuotes()
|
void |
parseQuotedQuoteCharacters()
|
void |
parseQuotedStringWithCommas()
|
void |
parseQuotedStringWithDefinedSeperator()
|
void |
parseQuotedStringWithDefinedSeperatorAndQuote()
|
void |
parseSimpleQuotedString()
|
void |
parseSimpleQuotedStringWithSpaces()
|
void |
parseSimpleString()
|
void |
parseTrickyString()
|
void |
pendingIsClearedAfterCallToParseLine()
|
void |
quoteAndEscapeCanBeTheSameIfNull()
|
void |
quoteAndEscapeCannotBeTheSame()
|
void |
returnNullWhenNullPassedIn()
|
void |
returnPendingIfNullIsPassedIntoParseLineMulti()
|
void |
separatorAndEscapeCannotBeTheSame()
|
void |
separatorAndQuoteCannotBeTheSame()
|
void |
separatorCharacterCannotBeNull()
|
void |
setUp()
|
void |
spacesAtEndOfQuotedStringDoNotCountIfStrictQuotesIsTrue()
|
void |
testADoubleQuoteAsDataElement()
|
void |
testAMultiLineInsideQuotes()
|
void |
testCanIgnoreQuotations()
|
void |
testEscapedDoubleQuoteAsDataElement()
|
void |
testIssue2263439()
Test issue 2263439 where an escaped quote was causing the parse to fail. |
void |
testIssue2726363()
Test issue 2726363
Data given:
"804503689","London",""London""shop","address","116.453182","39.918884"
"453074125","NewYork","brief","address"","121.514683","31.228511" |
void |
testIssue2859181()
Test issue 2859181 where an escaped character before a character
that did not need escaping was causing the parse to fail. |
void |
testIssue2958242WithoutQuotes()
|
void |
testIssue3314579()
This is an interesting issue where the data does not use quotes but IS using a quote within the field as a
inch symbol. |
void |
testParsedLineWithInternalQuota()
Tests quotes in the middle of an element. |
void |
testParseLine()
|
void |
testStrictQuoteSimple()
|
void |
testStrictQuoteWithGarbage()
|
void |
testStrictQuoteWithSpacesAndTabs()
|
void |
validateEscapeStringBeforeRealTest()
|
void |
whichCharactersAreEscapable()
|
void |
whitespaceBeforeEscape()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CSVParserTest
public CSVParserTest()
setUp
public void setUp()
testParseLine
public void testParseLine()
throws Exception
- Throws:
Exception
parseSimpleString
public void parseSimpleString()
throws IOException
- Throws:
IOException
parseSimpleQuotedString
public void parseSimpleQuotedString()
throws IOException
- Throws:
IOException
parseSimpleQuotedStringWithSpaces
public void parseSimpleQuotedStringWithSpaces()
throws IOException
- Throws:
IOException
testParsedLineWithInternalQuota
public void testParsedLineWithInternalQuota()
throws IOException
- Tests quotes in the middle of an element.
- Throws:
IOException - if bad things happen
parseQuotedStringWithCommas
public void parseQuotedStringWithCommas()
throws IOException
- Throws:
IOException
parseQuotedStringWithDefinedSeperator
public void parseQuotedStringWithDefinedSeperator()
throws IOException
- Throws:
IOException
parseQuotedStringWithDefinedSeperatorAndQuote
public void parseQuotedStringWithDefinedSeperatorAndQuote()
throws IOException
- Throws:
IOException
parseEmptyElements
public void parseEmptyElements()
throws IOException
- Throws:
IOException
parseMultiLinedQuoted
public void parseMultiLinedQuoted()
throws IOException
- Throws:
IOException
testADoubleQuoteAsDataElement
public void testADoubleQuoteAsDataElement()
throws IOException
- Throws:
IOException
testEscapedDoubleQuoteAsDataElement
public void testEscapedDoubleQuoteAsDataElement()
throws IOException
- Throws:
IOException
parseQuotedQuoteCharacters
public void parseQuotedQuoteCharacters()
throws IOException
- Throws:
IOException
parseMultipleQuotes
public void parseMultipleQuotes()
throws IOException
- Throws:
IOException
parseTrickyString
public void parseTrickyString()
throws IOException
- Throws:
IOException
testAMultiLineInsideQuotes
public void testAMultiLineInsideQuotes()
throws IOException
- Throws:
IOException
testStrictQuoteSimple
public void testStrictQuoteSimple()
throws IOException
- Throws:
IOException
testStrictQuoteWithSpacesAndTabs
public void testStrictQuoteWithSpacesAndTabs()
throws IOException
- Throws:
IOException
testStrictQuoteWithGarbage
public void testStrictQuoteWithGarbage()
throws IOException
- Throws:
IOException
testCanIgnoreQuotations
public void testCanIgnoreQuotations()
throws IOException
- Throws:
IOException
testIssue3314579
public void testIssue3314579()
throws IOException
- This is an interesting issue where the data does not use quotes but IS using a quote within the field as a
inch symbol. So we want to keep that quote as part of the field and not as the start or end of a field.
Test data is as follows.
RPO;2012;P; ; ; ;SDX;ACCESSORY WHEEL, 16", ALUMINUM, DESIGN 1
RPO;2012;P; ; ; ;SDZ;ACCESSORY WHEEL - 17" - ALLOY - DESIGN 1
- Throws:
IOException
testIssue2263439
public void testIssue2263439()
throws IOException
- Test issue 2263439 where an escaped quote was causing the parse to fail.
Special thanks to Chris Morris for fixing this (id 1979054)
- Throws:
IOException
testIssue2859181
public void testIssue2859181()
throws IOException
- Test issue 2859181 where an escaped character before a character
that did not need escaping was causing the parse to fail.
- Throws:
IOException
testIssue2726363
public void testIssue2726363()
throws IOException
- Test issue 2726363
Data given:
"804503689","London",""London""shop","address","116.453182","39.918884"
"453074125","NewYork","brief","address"","121.514683","31.228511"
- Throws:
IOException
anIOExceptionThrownifStringEndsInsideAQuotedString
public void anIOExceptionThrownifStringEndsInsideAQuotedString()
throws IOException
- Throws:
IOException
parseLineMultiAllowsQuotesAcrossMultipleLines
public void parseLineMultiAllowsQuotesAcrossMultipleLines()
throws IOException
- Throws:
IOException
pendingIsClearedAfterCallToParseLine
public void pendingIsClearedAfterCallToParseLine()
throws IOException
- Throws:
IOException
returnPendingIfNullIsPassedIntoParseLineMulti
public void returnPendingIfNullIsPassedIntoParseLineMulti()
throws IOException
- Throws:
IOException
spacesAtEndOfQuotedStringDoNotCountIfStrictQuotesIsTrue
public void spacesAtEndOfQuotedStringDoNotCountIfStrictQuotesIsTrue()
throws IOException
- Throws:
IOException
returnNullWhenNullPassedIn
public void returnNullWhenNullPassedIn()
throws IOException
- Throws:
IOException
validateEscapeStringBeforeRealTest
public void validateEscapeStringBeforeRealTest()
whichCharactersAreEscapable
public void whichCharactersAreEscapable()
whitespaceBeforeEscape
public void whitespaceBeforeEscape()
throws IOException
- Throws:
IOException
testIssue2958242WithoutQuotes
public void testIssue2958242WithoutQuotes()
throws IOException
- Throws:
IOException
quoteAndEscapeCannotBeTheSame
public void quoteAndEscapeCannotBeTheSame()
quoteAndEscapeCanBeTheSameIfNull
public void quoteAndEscapeCanBeTheSameIfNull()
separatorCharacterCannotBeNull
public void separatorCharacterCannotBeNull()
separatorAndEscapeCannotBeTheSame
public void separatorAndEscapeCannotBeTheSame()
separatorAndQuoteCannotBeTheSame
public void separatorAndQuoteCannotBeTheSame()
Copyright © 2011. All Rights Reserved.