private IMarker[] getSortedMarkersFromFile(String fileName) throws JavaModelException { IJavaElement fileToScan = TestingUtils.elementFromProject(testProject, fileName); IMarker[] markers = TestingUtils.getAllMarkersInResource(fileToScan.getCorrespondingResource()); // the markers get sorted first by bug name, then by line number, just like // the QuickFixTestPackages, so we have a reliable way to fix them // so we can assert properties more accurately. TestingUtils.sortMarkersByPatterns(markers); return markers; }
private void assertBugPatternsMatch(List<QuickFixTestPackage> packages, String testResource) throws JavaModelException { IMarker[] markers = TestingUtils.getAllMarkersInResource(testProject, testResource); TestingUtils.sortMarkersByPatterns(markers); // packages and markers should now be lined up to match up one to one. assertEquals( "The number of markers is wrong, check your turned off detectors?", packages.size(), markers.length); TestingUtils.assertBugPatternsMatch(packages, markers); TestingUtils.assertLabelsAndDescriptionsMatch(packages, markers, resolutionSource); TestingUtils.assertLineNumbersMatch(packages, markers); TestingUtils.assertAllMarkersHaveResolutions(markers, resolutionSource); }