use of com.airhacks.enhydrator.in.Row in project enhydrator by AdamBien.
the class PumpIT method applyExpressionsWithoutExpressions.
@Test
public void applyExpressionsWithoutExpressions() {
Pump pump = new Pump.Engine().build();
Row entries = getEntries();
int expected = entries.getNumberOfColumns();
pump.applyExpressions(entries);
int actual = entries.getNumberOfColumns();
assertThat(actual, is(expected));
}
use of com.airhacks.enhydrator.in.Row in project enhydrator by AdamBien.
the class SkipFirstRowTest method skipFirstRow.
@Test
public void skipFirstRow() {
SkipFirstRow cut = new SkipFirstRow();
Row actual = cut.execute(new Row());
assertNull(actual);
actual = cut.execute(new Row());
assertNotNull(actual);
}
use of com.airhacks.enhydrator.in.Row in project enhydrator by AdamBien.
the class StringValueFillerTest method nullRow.
@Test
public void nullRow() {
StringValueFiller filler = new StringValueFiller();
Row output = filler.execute(null);
assertNull(output);
}
use of com.airhacks.enhydrator.in.Row in project enhydrator by AdamBien.
the class StringValueFillerTest method fill.
@Test
public void fill() {
StringValueFiller filler = new StringValueFiller();
Row input = new Row();
input.addNullColumn(0, "name");
assertTrue(input.getColumnByIndex(0).isNullValue());
Row output = filler.execute(input);
assertFalse(output.getColumnByIndex(0).isNullValue());
}
use of com.airhacks.enhydrator.in.Row in project enhydrator by AdamBien.
the class CSVFileSinkTest method serializeLineWithHeaders.
@Test
public void serializeLineWithHeaders() {
cut.init();
final Row entries = getEntries();
cut.processRow(entries);
cut.close();
CSVFileSource source = new CSVFileSource(FILE_NAME, DELIMITER, "utf-8", USE_HEADERS);
Iterable<Row> result = source.query(null, null);
Row read = result.iterator().next();
assertNotNull(read);
System.out.println(entries.getColumnNames() + " " + read.getColumnNames());
System.out.println(entries.getColumnValues().values() + " " + read.getColumnValues().values());
if (USE_HEADERS) {
read.getColumnNames().stream().forEach(t -> assertTrue(entries.getColumnNames().contains(t)));
// ensure the order of the columns
assertEquals("Column One", read.getColumnByIndex(0).getName());
assertEquals("Column Two", read.getColumnByIndex(1).getName());
assertEquals("Column Three (empty)", read.getColumnByIndex(2).getName());
assertEquals("Column Four", read.getColumnByIndex(3).getName());
assertEquals("Column Five (empty)", read.getColumnByIndex(4).getName());
} else {
read.getColumnValues().values().stream().forEach(t -> assertTrue(entries.getColumnValues().values().contains(t)));
// ensure the order of the columns
assertEquals("java", read.getColumnByIndex(0).getValue());
assertEquals("tengah", read.getColumnByIndex(1).getValue());
assertNull(read.getColumnByIndex(2).getValue());
assertEquals("groovy", read.getColumnByIndex(3).getValue());
assertNull(read.getColumnByIndex(4).getValue());
}
}
Aggregations