bug 59791: make sure hard-coded int literals work for cell type

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1757237 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2016-08-22 18:14:46 +00:00
parent 3f4612ffcb
commit 75b943d69c

View File

@ -1030,6 +1030,7 @@ public abstract class BaseTestCell {
// Cell.CELL_TYPE_* -> CellType.* // Cell.CELL_TYPE_* -> CellType.*
cell.setCellValue(5.0); cell.setCellValue(5.0);
assertEquals(Cell.CELL_TYPE_NUMERIC, cell.getCellType()); assertEquals(Cell.CELL_TYPE_NUMERIC, cell.getCellType());
assertEquals(0, cell.getCellType()); //make sure that hard-coded int literals still work, even though users should be using the named constants
assertEquals(CellType.NUMERIC, cell.getCellTypeEnum()); // make sure old way and new way are compatible assertEquals(CellType.NUMERIC, cell.getCellTypeEnum()); // make sure old way and new way are compatible
// make sure switch(int|Enum) still works. Cases must be statically resolvable in Java 6 ("constant expression required") // make sure switch(int|Enum) still works. Cases must be statically resolvable in Java 6 ("constant expression required")
@ -1038,6 +1039,7 @@ public abstract class BaseTestCell {
// expected // expected
break; break;
case Cell.CELL_TYPE_STRING: case Cell.CELL_TYPE_STRING:
case Cell.CELL_TYPE_BOOLEAN:
case Cell.CELL_TYPE_ERROR: case Cell.CELL_TYPE_ERROR:
case Cell.CELL_TYPE_FORMULA: case Cell.CELL_TYPE_FORMULA:
case Cell.CELL_TYPE_BLANK: case Cell.CELL_TYPE_BLANK: