Sort members.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1509442 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary D. Gregory 2013-08-01 21:48:39 +00:00
parent 50b7f79338
commit 666350b94a
1 changed files with 17 additions and 17 deletions

View File

@ -26,19 +26,22 @@ public class CSVRecordBooleanTest {
private CSVRecord record; private CSVRecord record;
/**
* @return
* @throws IOException
*/
private CSVRecord createTestRecord() throws IOException {
String csv = "A,B,C,D\ntrue, TRUE, false, foo";
CSVRecord record = CSVParser.parseString(csv, CSVFormat.DEFAULT.withHeader().withIgnoreSurroundingSpaces(true))
.iterator().next();
return record;
}
@Before @Before
public void setUp() throws IOException { public void setUp() throws IOException {
this.record = createTestRecord(); this.record = createTestRecord();
} }
@Test
public void testGetBooleanByString() {
Assert.assertEquals(Boolean.TRUE, Boolean.valueOf(record.getBoolean("A")));
Assert.assertEquals(Boolean.TRUE, Boolean.valueOf(record.getBoolean("B")));
Assert.assertEquals(Boolean.FALSE, Boolean.valueOf(record.getBoolean("C")));
Assert.assertEquals(Boolean.FALSE, Boolean.valueOf(record.getBoolean("D")));
}
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
public void testGetBooleanByMissingString() { public void testGetBooleanByMissingString() {
Assert.assertEquals(null, Boolean.valueOf(record.getBoolean("ABSENT"))); Assert.assertEquals(null, Boolean.valueOf(record.getBoolean("ABSENT")));
@ -49,15 +52,12 @@ public class CSVRecordBooleanTest {
Assert.assertEquals(null, Boolean.valueOf(record.getBoolean(null))); Assert.assertEquals(null, Boolean.valueOf(record.getBoolean(null)));
} }
/** @Test
* @return public void testGetBooleanByString() {
* @throws IOException Assert.assertEquals(Boolean.TRUE, Boolean.valueOf(record.getBoolean("A")));
*/ Assert.assertEquals(Boolean.TRUE, Boolean.valueOf(record.getBoolean("B")));
private CSVRecord createTestRecord() throws IOException { Assert.assertEquals(Boolean.FALSE, Boolean.valueOf(record.getBoolean("C")));
String csv = "A,B,C,D\ntrue, TRUE, false, foo"; Assert.assertEquals(Boolean.FALSE, Boolean.valueOf(record.getBoolean("D")));
CSVRecord record = CSVParser.parseString(csv, CSVFormat.DEFAULT.withHeader().withIgnoreSurroundingSpaces(true))
.iterator().next();
return record;
} }
} }