/**
   * Tests if a {@link MatrixBuild} gets loaded and converted correctly from a version 1.2.0 save.
   *
   * @throws InterruptedException if it is not allowed to sleep in the beginning.
   */
  @LocalData
  public void testMatrix120() throws InterruptedException {
    MatrixProject project = (MatrixProject) jenkins.getItem("mymatrix");
    MatrixBuild build = project.getBuildByNumber(1);
    OldDataConverter.getInstance().waitForInitialCompletion();
    FailureCauseMatrixBuildAction matrixBuildAction =
        build.getAction(FailureCauseMatrixBuildAction.class);
    assertNotNull(matrixBuildAction);
    List<MatrixRun> runs = Whitebox.getInternalState(matrixBuildAction, "runs");
    assertNotNull(runs);
    List<String> runIds = null;

    runIds = Whitebox.getInternalState(matrixBuildAction, "runIds");

    assertEquals(runs.size(), runIds.size());
    assertNotNull(runs.get(3).getProject());
    assertEquals(runs.get(3).getProject().getCombination().toString(), runIds.get(3));
    assertNotNull(Whitebox.getInternalState(matrixBuildAction, "build"));

    MatrixBuild build2 = project.getBuildByNumber(2);
    List<MatrixRun> aggregatedRuns2 = FailureCauseMatrixAggregator.getRuns(build2);
    FailureCauseMatrixBuildAction matrixBuildAction2 =
        build2.getAction(FailureCauseMatrixBuildAction.class);
    assertNotNull(matrixBuildAction2);
    List<MatrixRun> runs2 = Whitebox.getInternalState(matrixBuildAction2, "runs");
    assertSame(aggregatedRuns2.get(5), runs2.get(5));
  }
 /**
  * Tests that a legacy FoundFailureCause can be loaded by the annotator.
  *
  * @throws Exception if so.
  */
 @LocalData
 public void testLoadOldFailureCauseWithOnlyLineNumbers() throws Exception {
   FreeStyleProject job = (FreeStyleProject) Jenkins.getInstance().getItem("MyProject");
   assertNotNull(job);
   FreeStyleBuild build = job.getBuilds().getFirstBuild();
   OldDataConverter.getInstance().waitForInitialCompletion();
   FailureCauseBuildAction action = build.getAction(FailureCauseBuildAction.class);
   List<FoundFailureCause> foundFailureCauses =
       Whitebox.getInternalState(action, "foundFailureCauses");
   FoundFailureCause foundFailureCause = foundFailureCauses.get(0);
   FoundIndication indication = foundFailureCause.getIndications().get(0);
   assertTrue(indication.getMatchingString().matches(indication.getPattern()));
   IndicationAnnotator annotator = new IndicationAnnotator(foundFailureCauses);
   Map<String, AnnotationHelper> helperMap = Whitebox.getInternalState(annotator, "helperMap");
   // since the old FoundIndication doesn't contain a matchingString from the start, we check it.
   AnnotationHelper annotationHelper = helperMap.get(indication.getMatchingString());
   assertNotNull(annotationHelper);
 }