From: Dominik Stadler Date: Wed, 17 Feb 2016 21:35:22 +0000 (+0000) Subject: Add test which verifies that bug 52684 is not a problem (any more) X-Git-Tag: REL_3_14_FINAL~32 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8cbb571d9cb5d4853de66c4d48bac59a3c8022ec;p=poi.git Add test which verifies that bug 52684 is not a problem (any more) git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1730948 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java index 013e41b5f9..e7860e50d8 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java @@ -1403,4 +1403,28 @@ public abstract class BaseTestBugzillaIssues { wb.close(); } + + @Test + public void test52684() { + Workbook wb = _testDataProvider.createWorkbook(); + + Sheet sheet = wb.createSheet("test"); + Row row = sheet.createRow(0); + Cell cell = row.createCell(0); + + cell.setCellValue(12312345123L); + + DataFormat format = wb.createDataFormat(); + CellStyle style = wb.createCellStyle(); + style.setDataFormat(format.getFormat("000-00000-000")); + cell.setCellStyle(style); + + assertEquals("000-00000-000", + cell.getCellStyle().getDataFormatString()); + assertEquals(164, cell.getCellStyle().getDataFormat()); + + DataFormatter formatter = new DataFormatter(); + + assertEquals("12-312-345-123", formatter.formatCellValue(cell)); + } }