}
public void testStyles() {
XSSFWorkbook workbook = XSSFTestDataSamples.openSampleWorkbook("Formatting.xlsx");
StylesTable ss = workbook.getStylesSource();
assertNotNull(ss);
StylesTable st = ss;
// Has 8 number formats
assertEquals(8, st._getNumberFormatSize());
// Has 2 fonts
assertEquals(2, st.getFonts().size());
// Has 2 fills
assertEquals(2, st.getFills().size());
// Has 1 border
assertEquals(1, st.getBorders().size());
// Add two more styles
assertEquals(StylesTable.FIRST_CUSTOM_STYLE_ID + 8,
st.putNumberFormat("testFORMAT"));
assertEquals(StylesTable.FIRST_CUSTOM_STYLE_ID + 8,
st.putNumberFormat("testFORMAT"));
assertEquals(StylesTable.FIRST_CUSTOM_STYLE_ID + 9,
st.putNumberFormat("testFORMAT2"));
assertEquals(10, st._getNumberFormatSize());
// Save, load back in again, and check
workbook = XSSFTestDataSamples.writeOutAndReadBack(workbook);
ss = workbook.getStylesSource();
assertNotNull(ss);
assertEquals(10, st._getNumberFormatSize());
assertEquals(2, st.getFonts().size());
assertEquals(2, st.getFills().size());
assertEquals(1, st.getBorders().size());
}