RuleSet implements ChecksumAware { @Override public boolean equals(Object o) { if (!(o instanceof RuleSet)) { return false; } if (this == o) { return true; } RuleSet ruleSet = (RuleSet) o; return getName().equals(ruleSet.getName()) && getRules().equals(ruleSet.getRules()); } private  RuleSet(final RuleSetBuilder builder);  RuleSet(final RuleSet rs); @Deprecated List<String> getExcludePatterns(); int size(); Collection<Rule> getRules(); Rule getRuleByName(String ruleName); boolean applies(File file); void start(RuleContext ctx); void apply(List<? extends Node> acuList, RuleContext ctx); static boolean applies(Rule rule, LanguageVersion languageVersion); void end(RuleContext ctx); @Override boolean equals(Object o); @Override int hashCode(); String getFileName(); String getName(); String getDescription(); @Deprecated List<String> getIncludePatterns(); List<Pattern> getFileExclusions(); List<Pattern> getFileInclusions(); @Deprecated boolean usesDFA(Language language); @Deprecated boolean usesTypeResolution(Language language); @Deprecated boolean usesMultifile(Language language); void removeDysfunctionalRules(Collection<Rule> collector); @Override long getChecksum();  }
@Test public void testEquals1() { RuleSet s = createRuleSetBuilder("ruleset").build(); assertFalse("A ruleset cannot be equals to null", s.equals(null)); }
@Test @SuppressWarnings("PMD.UseAssertEqualsInsteadOfAssertTrue") public void testEquals2() { RuleSet s = createRuleSetBuilder("ruleset").build(); assertTrue("A rulset must be equals to itself", s.equals(s)); }
@Test public void testEquals3() { RuleSet s = new RuleSetBuilder(new Random().nextLong()) .withName("basic rules") .withDescription("desc") .build(); assertFalse("A ruleset cannot be equals to another kind of object", s.equals("basic rules")); }
@Test public void testEquals5() { RuleSet s1 = createRuleSetBuilder("my ruleset") .addRule(new MockRule("name", "desc", "msg", "rulesetname")) .build(); RuleSet s2 = createRuleSetBuilder("my other ruleset") .addRule(new MockRule("name", "desc", "msg", "rulesetname")) .build(); assertFalse("2 rulesets with different name but same rules must not be equals", s1.equals(s2)); }
@Test public void testEquals6() { RuleSet s1 = createRuleSetBuilder("my ruleset") .addRule(new MockRule("name", "desc", "msg", "rulesetname")) .build(); RuleSet s2 = createRuleSetBuilder("my ruleset") .addRule(new MockRule("other rule", "desc", "msg", "rulesetname")) .build(); assertFalse("2 rulesets with same name but different rules must not be equals", s1.equals(s2)); }