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:
parent
50b7f79338
commit
666350b94a
|
@ -26,19 +26,22 @@ public class CSVRecordBooleanTest {
|
|||
|
||||
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
|
||||
public void setUp() throws IOException {
|
||||
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)
|
||||
public void testGetBooleanByMissingString() {
|
||||
Assert.assertEquals(null, Boolean.valueOf(record.getBoolean("ABSENT")));
|
||||
|
@ -49,15 +52,12 @@ public class CSVRecordBooleanTest {
|
|||
Assert.assertEquals(null, Boolean.valueOf(record.getBoolean(null)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
@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")));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue