/** * {@link DataModelCondition} - strict. * * @throws Exception if occur */ @Test public void extractDataModelCondition_strict() throws Exception { ExcelRuleExtractor extractor = new DefaultExcelRuleExtractor(); Sheet sheet = sheet("total_strict.xls"); assertThat( extractor.extractDataModelCondition(sheet), is((Object) EnumSet.noneOf(DataModelCondition.class))); }
/** * {@link DataModelCondition} - expected only. * * @throws Exception if occur */ @Test public void extractDataModelCondition_expect() throws Exception { ExcelRuleExtractor extractor = new DefaultExcelRuleExtractor(); Sheet sheet = sheet("total_expect.xls"); assertThat( extractor.extractDataModelCondition(sheet), is((Object) EnumSet.of(DataModelCondition.IGNORE_UNEXPECTED))); }
/** * name. * * @throws Exception if occur */ @Test public void extractName() throws Exception { ExcelRuleExtractor extractor = new DefaultExcelRuleExtractor(); Sheet sheet = sheet("name.xls"); assertThat(extractor.extractName(sheet.getRow(3)), is("value")); assertThat(extractor.extractName(sheet.getRow(4)), is("a")); assertThat(extractor.extractName(sheet.getRow(5)), is("very_long_name")); }
/** * value. * * @throws Exception if occur */ @Test public void extractValueCondition() throws Exception { ExcelRuleExtractor extractor = new DefaultExcelRuleExtractor(); Sheet sheet = sheet("value.xls"); assertThat(extractor.extractValueCondition(sheet.getRow(3)), is(ValueConditionKind.ANY)); assertThat(extractor.extractValueCondition(sheet.getRow(4)), is(ValueConditionKind.KEY)); assertThat(extractor.extractValueCondition(sheet.getRow(5)), is(ValueConditionKind.EQUAL)); assertThat(extractor.extractValueCondition(sheet.getRow(6)), is(ValueConditionKind.CONTAIN)); assertThat(extractor.extractValueCondition(sheet.getRow(7)), is(ValueConditionKind.TODAY)); assertThat(extractor.extractValueCondition(sheet.getRow(8)), is(ValueConditionKind.NOW)); }
/** @throws Exception if occur */ @Test public void extractNullityCondition() throws Exception { ExcelRuleExtractor extractor = new DefaultExcelRuleExtractor(); Sheet sheet = sheet("nullity.xls"); assertThat(extractor.extractNullityCondition(sheet.getRow(3)), is(NullityConditionKind.NORMAL)); assertThat( extractor.extractNullityCondition(sheet.getRow(4)), is(NullityConditionKind.ACCEPT_ABSENT)); assertThat( extractor.extractNullityCondition(sheet.getRow(5)), is(NullityConditionKind.DENY_ABSENT)); assertThat( extractor.extractNullityCondition(sheet.getRow(6)), is(NullityConditionKind.ACCEPT_PRESENT)); assertThat( extractor.extractNullityCondition(sheet.getRow(7)), is(NullityConditionKind.DENY_PRESENT)); }
/** * not supported because is not a valid version. * * @throws Exception if occur */ @Test public void supports_invalid_version() throws Exception { ExcelRuleExtractor extractor = new DefaultExcelRuleExtractor(); Sheet sheet = sheet("invalid_format_version.xls"); assertThat(extractor.supports(sheet), is(false)); }
/** * using xlsx. * * @throws Exception if occur */ @Test public void xssf() throws Exception { ExcelRuleExtractor extractor = new DefaultExcelRuleExtractor(); Sheet sheet = sheet("simple.xlsx"); assertThat(extractor.supports(sheet), is(true)); }
/** * nullity - invalid cell. * * @throws Exception if occur */ @Test(expected = ExcelRuleExtractor.FormatException.class) public void extractNullityCondition_invalid() throws Exception { ExcelRuleExtractor extractor = new DefaultExcelRuleExtractor(); Sheet sheet = sheet("nullity.xls"); extractor.extractNullityCondition(sheet.getRow(11)); }
/** * value - blank cell. * * @throws Exception if occur */ @Test(expected = ExcelRuleExtractor.FormatException.class) public void extractValueCondition_blank() throws Exception { ExcelRuleExtractor extractor = new DefaultExcelRuleExtractor(); Sheet sheet = sheet("value.xls"); extractor.extractValueCondition(sheet.getRow(11)); }
/** * name - invalid type. * * @throws Exception if occur */ @Test(expected = ExcelRuleExtractor.FormatException.class) public void extractName_invalid() throws Exception { ExcelRuleExtractor extractor = new DefaultExcelRuleExtractor(); Sheet sheet = sheet("name.xls"); extractor.extractName(sheet.getRow(8)); }
/** * {@link DataModelCondition} - missing row. * * @throws Exception if occur */ @Test(expected = ExcelRuleExtractor.FormatException.class) public void extractDataModelCondition_missing() throws Exception { ExcelRuleExtractor extractor = new DefaultExcelRuleExtractor(); Sheet sheet = sheet("total_missing.xls"); extractor.extractDataModelCondition(sheet); }
/** * name - blank cell. * * @throws Exception if occur */ @Test public void extractName_blank() throws Exception { ExcelRuleExtractor extractor = new DefaultExcelRuleExtractor(); Sheet sheet = sheet("name.xls"); assertThat(extractor.extractName(sheet.getRow(7)), is(nullValue())); }
/** * start row. * * @throws Exception if occur */ @Test public void extractPropertyRowStartIndex() throws Exception { ExcelRuleExtractor extractor = new DefaultExcelRuleExtractor(); Sheet sheet = sheet("simple.xls"); assertThat(extractor.extractPropertyRowStartIndex(sheet), is(3)); }