/** * @since 2.6 */ public boolean isEnabled() { return getRule() != null && getRule().isEnabled(); } }
@Test public void should_success_finder_wrap() { // has Id assertThat(underTest.findById(rule1.getId()).getId()).isEqualTo(rule1.getId()); // should_find_by_id assertThat(underTest.findById(rule3.getId()).getConfigKey()).isEqualTo("Checker/Treewalker/AnnotationUseStyleCheck"); // should_not_find_disabled_rule_by_id assertThat(underTest.findById(rule2.getId())).isNull(); // should_find_by_key Rule rule = underTest.findByKey("checkstyle", "com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck"); assertThat(rule).isNotNull(); assertThat(rule.getKey()).isEqualTo(("com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck")); assertThat(rule.isEnabled()).isTrue(); // find_should_return_null_if_no_results assertThat(underTest.findByKey("checkstyle", "unknown")).isNull(); assertThat(underTest.find(RuleQuery.create().withRepositoryKey("checkstyle").withConfigKey("unknown"))).isNull(); // find_repository_rules assertThat(underTest.findAll(RuleQuery.create().withRepositoryKey("checkstyle"))).hasSize(2); // find_all_enabled assertThat(underTest.findAll(RuleQuery.create())).extracting("id").containsOnly(rule1.getId(), rule3.getId(), rule4.getId()); assertThat(underTest.findAll(RuleQuery.create())).hasSize(3); // do_not_find_disabled_rules assertThat(underTest.findByKey("checkstyle", "DisabledCheck")).isNull(); // do_not_find_unknown_rules assertThat(underTest.findAll(RuleQuery.create().withRepositoryKey("unknown_repository"))).isEmpty(); }
/** * @since 2.6 */ public boolean isEnabled() { return getRule() != null && getRule().isEnabled(); } }
/** * @since 2.6 */ public boolean isEnabled() { return getRule() != null && getRule().isEnabled(); } }