/** * {@link DataModelCondition} - ignore all. * * @throws Exception if occur */ @Test public void skip_key() throws Exception { VerifyRule rule = rule("verify/skip.xls"); Object k0 = rule.getKey(obj(1, "a")); Object k1 = rule.getKey(obj(1, "a")); Object k2 = rule.getKey(obj(1, "a")); assertThat(k0, not(equalTo(k1))); assertThat(k0, not(equalTo(k2))); assertThat(k1, not(equalTo(k2))); }
/** * 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())); }
/** * simple verification via SPI. * * @throws Exception if occur */ @Test public void spi() throws Exception { VerifyRuleProvider provider = new SpiVerifyRuleProvider(ExcelSheetRuleProvider.class.getClassLoader()); VerifyRule rule = provider.get(SIMPLE, context(10), uri("verify/simple.xls", ":0")); 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} - keys. * * @throws Exception if occur */ @Test public void value_keys() throws Exception { VerifyRule rule = rule("verify/value_keys.xls"); assertThat(rule.getKey(obj(1, "a")), equalTo(rule.getKey(obj(1, "a")))); assertThat(rule.getKey(obj(2, "b")), equalTo(rule.getKey(obj(2, "b")))); assertThat(rule.getKey(obj(1, "a")), not(equalTo(rule.getKey(obj(2, "a"))))); assertThat(rule.getKey(obj(1, "a")), not(equalTo(rule.getKey(obj(1, "b"))))); assertThat(rule.verify(obj(1, "a"), obj(1, "a")), is(nullValue())); assertThat(rule.verify(obj(1, "a"), obj(2, "b")), is(nullValue())); assertThat(rule.verify(null, obj(1, "a")), not(nullValue())); assertThat(rule.verify(obj(1, "a"), null), not(nullValue())); }