use of jxl.write.WritableCellFormat in project pentaho-kettle by pentaho.
the class ExcelOutputTest method testClosingFile.
@Test
public /**
* Tests http://jira.pentaho.com/browse/PDI-13487 issue
*/
void testClosingFile() throws Exception {
ValueMetaInterface vmi = new ValueMetaString("new_row");
ExcelOutputData data = new ExcelOutputData();
data.fieldnrs = new int[] { 0 };
String testColumnName = "testColumnName";
data.formats.put(testColumnName, new WritableCellFormat());
RowMeta rowMetaToBeReturned = Mockito.spy(new RowMeta());
rowMetaToBeReturned.addValueMeta(0, vmi);
data.previousMeta = rowMetaToBeReturned;
ExcelOutput excelOutput = Mockito.spy(new ExcelOutput(helper.stepMeta, data, 0, helper.transMeta, helper.trans));
excelOutput.first = false;
Object[] row = { new Date() };
doReturn(row).when(excelOutput).getRow();
doReturn(rowMetaToBeReturned).when(excelOutput).getInputRowMeta();
doReturn(1L).when(excelOutput).getLinesOutput();
String excelFileFullPath = buildFilePath();
File excelFile = new File(excelFileFullPath);
excelFile.deleteOnExit();
ExcelOutputMeta meta = createStepMeta(excelFileFullPath, null, true);
meta.setSplitEvery(1);
excelOutput.init(meta, data);
excelOutput.processRow(meta, data);
Assert.assertNull(data.formats.get(testColumnName));
}
Aggregations