Package org.apache.poi.ss.usermodel

Examples of org.apache.poi.ss.usermodel.Sheet


            throw new AssertionError(e);
        }
        InputStream in = resource.openStream();
        try {
            Workbook book = Util.openWorkbookFor(file, in);
            Sheet sheet = book.getSheetAt(0);
            return new ExcelSheetDataModelSource(SIMPLE, uri, sheet);
        } finally {
            in.close();
        }
    }
View Full Code Here


     * supported.
     */
    @Test
    public void supports() {
        ExcelRuleExtractor extractor = new LegacyExcelRuleExtractor();
        Sheet sheet = sheet("legacy-rule.xls");
        assertThat(extractor.supports(sheet), is(true));
    }
View Full Code Here

     * not supported.
     */
    @Test
    public void supports_not() {
        ExcelRuleExtractor extractor = new LegacyExcelRuleExtractor();
        Sheet sheet = sheet("invalid.xls");
        assertThat(extractor.supports(sheet), is(false));
    }
View Full Code Here

     * @throws Exception if failed
     */
    @Test
    public void extractDataModelCondition_ignore() throws Exception {
        ExcelRuleExtractor extractor = new LegacyExcelRuleExtractor();
        Sheet sheet = sheet("ignore.xls");
        assertThat(extractor.extractDataModelCondition(sheet),
                is((Object) EnumSet.allOf(DataModelCondition.class)));
    }
View Full Code Here

     * @throws Exception if failed
     */
    @Test
    public void extractDataModelCondition_strict() throws Exception {
        ExcelRuleExtractor extractor = new LegacyExcelRuleExtractor();
        Sheet sheet = sheet("strict.xls");
        assertThat(extractor.extractDataModelCondition(sheet),
                is((Object) EnumSet.noneOf(DataModelCondition.class)));
    }
View Full Code Here

     * @throws Exception if failed
     */
    @Test
    public void extractDataModelCondition_partial() throws Exception {
        ExcelRuleExtractor extractor = new LegacyExcelRuleExtractor();
        Sheet sheet = sheet("partial.xls");
        assertThat(extractor.extractDataModelCondition(sheet),
                is((Object) EnumSet.of(DataModelCondition.IGNORE_UNEXPECTED)));
    }
View Full Code Here

     * @throws Exception if failed
     */
    @Test(expected = ExcelRuleExtractor.FormatException.class)
    public void extractDataModelCondition_invalid() throws Exception {
        ExcelRuleExtractor extractor = new LegacyExcelRuleExtractor();
        Sheet sheet = sheet("invalid.xls");
        extractor.extractDataModelCondition(sheet);
    }
View Full Code Here

     * @throws Exception if failed
     */
    @Test
    public void extractPropertyRowStartIndex() throws Exception {
        ExcelRuleExtractor extractor = new LegacyExcelRuleExtractor();
        Sheet sheet = sheet("legacy-rule.xls");
        assertThat(extractor.extractPropertyRowStartIndex(sheet), is(3));
    }
View Full Code Here

     * @throws Exception if failed
     */
    @Test
    public void extractName() throws Exception {
        ExcelRuleExtractor extractor = new LegacyExcelRuleExtractor();
        Sheet sheet = sheet("legacy-rule.xls");
        assertThat(extractor.extractName(sheet.getRow(3)), is("sid"));
        assertThat(extractor.extractName(sheet.getRow(4)), is("version_no"));
        assertThat(extractor.extractName(sheet.getRow(5)), is("rgst_datetime"));
        assertThat(extractor.extractName(sheet.getRow(6)), is("updt_datetime"));
        assertThat(extractor.extractName(sheet.getRow(7)), is("code"));
    }
View Full Code Here

     * @throws Exception if failed
     */
    @Test
    public void extractName_empty() throws Exception {
        ExcelRuleExtractor extractor = new LegacyExcelRuleExtractor();
        Sheet sheet = sheet("invalid.xls");
        assertThat(extractor.extractName(sheet.getRow(3)), is(nullValue()));
        assertThat(extractor.extractName(sheet.getRow(4)), is(nullValue()));
    }
View Full Code Here

TOP

Related Classes of org.apache.poi.ss.usermodel.Sheet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.