List of usage examples for org.apache.poi.ss.usermodel Workbook getSheetAt
Sheet getSheetAt(int index);
From source file:net.ceos.project.poi.annotated.core.MaskTest.java
License:Apache License
/** * /*from w w w. ja va 2 s .co m*/ * Test the marshal/unmarshal of one object applying mask at the Double * attribute with {@link XlsElement} */ @Test(dataProvider = "dataProvider") public void checkDoubleTransformMask(ObjectMask charger, Workbook wb) throws Exception { // transform double attributes Cell cellDouble1 = extractCell(charger, wb.getSheetAt(0), 11); assertEquals(Double.valueOf(cellDouble1.getStringCellValue()), charger.getDoubleAttribute4()); Cell cellDouble2 = extractCell(charger, wb.getSheetAt(0), 12); assertEquals(Double.valueOf(cellDouble2.getStringCellValue()), charger.getDoubleAttribute5()); }
From source file:net.ceos.project.poi.annotated.core.MaskTest.java
License:Apache License
/** * /*from w w w . j a v a2 s . c o m*/ * Test the marshal/unmarshal of one object applying mask at the Float * attribute with {@link XlsElement} */ // @Test(dataProvider = "dataProvider") public void checkFloatFormatMask(ObjectMask charger, Workbook wb) throws Exception { // FIX this problem : incorrect application of the mask // format float attributes Cell cellFloat1 = extractCell(charger, wb.getSheetAt(0), 20); assertEquals(cellFloat1.getNumericCellValue(), charger.getFloatAttribute2()); Cell cellFloat2 = extractCell(charger, wb.getSheetAt(0), 21); assertEquals(cellFloat2.getNumericCellValue(), charger.getFloatAttribute3()); }
From source file:net.ceos.project.poi.annotated.core.MaskTest.java
License:Apache License
/** * // w w w.ja v a2s.c o m * Test the marshal/unmarshal of one object applying mask at the Float * attribute with {@link XlsElement} */ @Test(dataProvider = "dataProvider") public void checkFloatTransformMask(ObjectMask charger, Workbook wb) throws Exception { // transform float attributes Cell cellFloat1 = extractCell(charger, wb.getSheetAt(0), 22); String floatStr1 = charger.getFloatAttribute4().toString(); assertEquals(cellFloat1.getStringCellValue().startsWith(floatStr1.substring(0, floatStr1.length() - 1)), true); Cell cellFloat2 = extractCell(charger, wb.getSheetAt(0), 23); String floatStr2 = String.valueOf(charger.getFloatAttribute5()); assertEquals(cellFloat2.getStringCellValue().startsWith(floatStr2.substring(0, floatStr2.length() - 1)), true); }
From source file:net.ceos.project.poi.annotated.core.MaskTest.java
License:Apache License
/** * // ww w . ja v a 2 s . c o m * Test the marshal/unmarshal of one object applying mask at the BigDecimal * attribute with {@link XlsElement} */ @Test(dataProvider = "dataProvider") public void checkBigDecimalTransformMask(ObjectMask charger, Workbook wb) throws Exception { // transform bigdecimal attributes Cell cellBD1 = extractCell(charger, wb.getSheetAt(0), 16); assertEquals(charger.getBigDecimalAttribute4(), BigDecimal.valueOf(Double.valueOf(cellBD1.getStringCellValue()))); Cell cellBD2 = extractCell(charger, wb.getSheetAt(0), 17); assertEquals(charger.getBigDecimalAttribute5(), BigDecimal.valueOf(Double.valueOf(cellBD2.getStringCellValue()))); Cell cellBD3 = extractCell(charger, wb.getSheetAt(0), 18); assertEquals(charger.getBigDecimalAttribute6(), BigDecimal.valueOf(Double.valueOf(cellBD3.getStringCellValue()))); }
From source file:net.ceos.project.poi.annotated.core.MaskTest.java
License:Apache License
/** * //w w w . j a v a 2 s .co m * Test the marshal/unmarshal of one object applying mask at the Boolean * attribute with {@link XlsElement} */ @Test(dataProvider = "dataProvider") public void checkBooleanFormatMask(ObjectMask charger, Workbook wb) throws Exception { // format boolean attributes Cell cellBool1 = extractCell(charger, wb.getSheetAt(0), 27); assertNotEquals(cellBool1.getStringCellValue(), "No No"); assertEquals(charger.isBooleanAttribute4(), cellBool1.getStringCellValue().equals("false") ? false : true); }
From source file:net.ceos.project.poi.annotated.core.MaskTest.java
License:Apache License
/** * /*from ww w .j a v a 2 s. c o m*/ * Test the marshal/unmarshal of one object applying mask at the Boolean * attribute with {@link XlsElement} */ @Test(dataProvider = "dataProvider") public void checkBooleanTransformMask(ObjectMask charger, Workbook wb) throws Exception { // transform boolean attributes Cell cellBool1 = extractCell(charger, wb.getSheetAt(0), 24); assertEquals(charger.isBooleanAttribute1(), parserBoolean(cellBool1.getStringCellValue(), "Yes/No")); Cell cellBool2 = extractCell(charger, wb.getSheetAt(0), 26); assertEquals(charger.getBooleanAttribute3(), Boolean.valueOf(parserBoolean(cellBool2.getStringCellValue(), "Oui/Non"))); }
From source file:net.ceos.project.poi.annotated.core.MaskTest.java
License:Apache License
/** * /*from w ww . j a v a 2s .co m*/ * Test the marshal/unmarshal of one object applying mask at the Boolean * attribute with {@link XlsElement} */ @Test(dataProvider = "dataProvider") public void checkIntegerFormatMask(ObjectMask charger, Workbook wb) throws Exception { // transform integer attributes Cell cellInteger = extractCell(charger, wb.getSheetAt(0), 28); assertEquals(charger.getIntegerAttribute1(), Integer.valueOf((int) cellInteger.getNumericCellValue())); assertEquals(parserNumeric(charger.getIntegerAttribute1(), "0.0"), cellInteger.getNumericCellValue()); }
From source file:net.ceos.project.poi.annotated.core.MaskTest.java
License:Apache License
/** * //from ww w .j a v a2 s . co m * Test the marshal/unmarshal of one object applying mask at the Boolean * attribute with {@link XlsElement} */ @Test(dataProvider = "dataProvider") public void checkIntegerTransformMask(ObjectMask charger, Workbook wb) throws Exception { // transform integer attributes Cell cellInteger = extractCell(charger, wb.getSheetAt(0), 29); assertEquals(String.valueOf(parserNumeric(charger.getIntAttribute2(), "0.0")), cellInteger.getStringCellValue()); }
From source file:net.ceos.project.poi.annotated.core.MaskTest.java
License:Apache License
/** * /*www .j a v a 2 s. c o m*/ * Test the marshal/unmarshal of one object applying mask at the Boolean * attribute with {@link XlsElement} */ @Test(dataProvider = "dataProvider") public void checkShortFormatMask(ObjectMask charger, Workbook wb) throws Exception { // transform short attributes Cell cellShort = extractCell(charger, wb.getSheetAt(0), 30); assertEquals(charger.getShortAttribute1(), (short) cellShort.getNumericCellValue()); assertEquals(parserNumeric(charger.getShortAttribute1(), "0.0000"), cellShort.getNumericCellValue()); }
From source file:net.ceos.project.poi.annotated.core.MaskTest.java
License:Apache License
/** * //from ww w .j a v a 2 s . c o m * Test the marshal/unmarshal of one object applying mask at the Boolean * attribute with {@link XlsElement} */ @Test(dataProvider = "dataProvider") public void checkShortTransformMask(ObjectMask charger, Workbook wb) throws Exception { // transform short attributes Cell cellShort = extractCell(charger, wb.getSheetAt(0), 31); assertEquals(String.valueOf(parserNumeric(charger.getShortAttribute2(), "0.0")), cellShort.getStringCellValue()); }