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);
  }