use of io.atlasmap.csv.v2.CsvComplexType in project atlasmap by atlasmap.
the class CsvFieldReaderTest method testReadSchemaWithFirstRecordAsHeader.
@Test
public void testReadSchemaWithFirstRecordAsHeader() throws Exception {
CsvConfig csvConfig = new CsvConfig();
csvConfig.setFirstRecordAsHeader(true);
CsvFieldReader csvFieldReader = new CsvFieldReader(csvConfig);
csvFieldReader.setDocument(new ByteArrayInputStream("givenName,familyName\nBob,Smith\nAndrew,Johnson".getBytes()));
AtlasInternalSession session = mock(AtlasInternalSession.class);
when(session.head()).thenReturn(mock(AtlasInternalSession.Head.class));
Document document = csvFieldReader.readSchema();
CsvComplexType list = (CsvComplexType) document.getFields().getField().get(0);
assertEquals("givenName", list.getCsvFields().getCsvField().get(0).getName());
assertEquals("familyName", list.getCsvFields().getCsvField().get(1).getName());
}
Aggregations