AbstractRuleViolationFactory implements RuleViolationFactory { @Override public void addViolation(RuleContext ruleContext, Rule rule, Node node, String message, Object[] args) { String formattedMessage = cleanup(message, args); ruleContext.getReport().addRuleViolation(createRuleViolation(rule, ruleContext, node, formattedMessage)); }  @Override void addViolation(RuleContext ruleContext, Rule rule, Node node, String message, Object[] args); @Override void addViolation(RuleContext ruleContext, Rule rule, Node node, String message, int beginLine, int endLine,
            Object[] args);  }
@Test public void testMessage() { factory.addViolation(ruleContext, new TestRule(), null, "message with \"'{'\"", null); RuleViolation violation = ruleContext.getReport().iterator().next(); Assert.assertEquals("message with \"{\"", violation.getDescription()); }
@Test public void testMessageArgs() { factory.addViolation(ruleContext, new TestRule(), null, "message with 1 argument: \"{0}\"", new Object[] {"testarg1"}); RuleViolation violation = ruleContext.getReport().iterator().next(); Assert.assertEquals("message with 1 argument: \"testarg1\"", violation.getDescription()); }