private VerifyRule rule(String name, VerifyContext context) throws Exception { assert name != null; ExcelSheetRuleProvider provider = new ExcelSheetRuleProvider(); VerifyRule rule = provider.get(SIMPLE, context, uri(name, ":0")); assertThat(rule, not(nullValue())); return rule; }
/** * integration test with test-data-generator. * * @throws Exception if occur */ @Test public void integration() throws Exception { ExcelSheetRuleProvider provider = new ExcelSheetRuleProvider(); VerifyRule rule = provider.get(SIMPLE, context(10), uri("it/simple.xls", ":2")); assertThat(rule, not(nullValue())); assertThat(rule.getKey(obj(100, "a")), equalTo(rule.getKey(obj(100, "b")))); assertThat(rule.getKey(obj(100, "a")), not(equalTo(rule.getKey(obj(200, "a"))))); assertThat(rule.verify(obj(1, "a"), obj(2, "a")), is(nullValue())); assertThat(rule.verify(obj(1, "a"), obj(1, "b")), not(nullValue())); }
/** * {@link ValueConditionKind} - expr. * * @throws Exception if occur */ @Test public void value_expr() throws Exception { ExcelSheetRuleProvider provider = new ExcelSheetRuleProvider(); VerifyRule rule = provider.get(SIMPLE, context(10), uri("verify/value_approx.xls", ":0")); assertThat(rule, not(nullValue())); assertThat(rule.verify(num(1, 1.0), num(1, 1.0)), is(nullValue())); assertThat(rule.verify(num(1, 1.0), num(1, 1.49)), is(nullValue())); assertThat(rule.verify(num(1, 1.0), num(1, 1.51)), is(notNullValue())); assertThat(rule.verify(num(1, 1.0), num(1, 0.51)), is(nullValue())); assertThat(rule.verify(num(1, 1.0), num(1, 0.49)), is(notNullValue())); }