List of usage examples for org.apache.poi.xssf.model StylesTable getNumberFormatAt
@Override public String getNumberFormatAt(short fmtId)
From source file:org.pentaho.di.trans.steps.excelinput.staxpoi.StaxPoiSheetTest.java
License:Apache License
private StylesTable mockStylesTable(final Map<Integer, Integer> styleToNumFmtId, final Map<Integer, String> numFmts) { StylesTable styles = mock(StylesTable.class); when(styles.getCellXfAt(any(Integer.class))).then(new Answer<CTXf>() { public CTXf answer(InvocationOnMock invocation) throws Throwable { int style = (int) invocation.getArguments()[0]; Integer numFmtId = styleToNumFmtId.get(style); if (numFmtId != null) { CTXf ctxf = CTXf.Factory.newInstance(); ctxf.setNumFmtId(numFmtId); return ctxf; } else { return null; }// w ww. ja v a2 s . co m } }); when(styles.getNumberFormatAt(any(Short.class))).then(new Answer<String>() { public String answer(InvocationOnMock invocation) throws Throwable { return numFmts.get(invocation.getArguments()[0]); } }); return styles; }