use of org.molgenis.data.Writable in project molgenis by molgenis.
the class ExcelWriterTest method addCellProcessor_data.
@Test
public void addCellProcessor_data() throws IOException {
CellProcessor processor = when(mock(CellProcessor.class).processData()).thenReturn(true).getMock();
OutputStream os = mock(OutputStream.class);
ExcelWriter excelWriter = new ExcelWriter(os, attrMetaFactory);
excelWriter.addCellProcessor(processor);
try {
Entity entity = new DynamicEntity(mock(EntityType.class)) {
@Override
protected void validateValueType(String attrName, Object value) {
// noop
}
};
entity.set("col1", "val1");
entity.set("col2", "val2");
Writable writable = excelWriter.createWritable("test", Arrays.asList("col1", "col2"));
writable.add(entity);
} finally {
excelWriter.close();
}
verify(processor).process("val1");
verify(processor).process("val2");
}
Aggregations