Test checkHasViolations function