private void reportDuplicatedCases(final List<TestCase> cases) { final Set<String> duplicatedNames = newHashSet(); for (final TestCase case1 : cases) { for (final TestCase case2 : cases) { if (case1 != case2) { final String case1Name = case1.getTestName().getText(); final String case2Name = case2.getTestName().getText(); if (case1Name.equalsIgnoreCase(case2Name)) { duplicatedNames.add(case1Name.toLowerCase()); } } } } for (final TestCase testCase : cases) { final RobotToken caseName = testCase.getTestName(); final String name = caseName.getText(); if (duplicatedNames.contains(name.toLowerCase())) { final RobotProblem problem = RobotProblem.causedBy(TestCasesProblem.DUPLICATED_CASE).formatMessageWith(name); final Map<String, Object> additionalArguments = ImmutableMap.<String, Object>of("name", name); reporter.handleProblem(problem, validationContext.getFile(), caseName, additionalArguments); } } }
private void reportEmptyCases(final List<TestCase> cases) { for (final TestCase testCase : cases) { final RobotToken caseName = testCase.getTestName(); if (!hasAnythingToExecute(testCase)) { final String name = caseName.getText(); final RobotProblem problem = RobotProblem.causedBy(TestCasesProblem.EMPTY_CASE).formatMessageWith(name); final Map<String, Object> arguments = ImmutableMap.<String, Object>of(AdditionalMarkerAttributes.NAME, name); reporter.handleProblem(problem, validationContext.getFile(), caseName, arguments); } } }