@Test
  public void testNoInfiniteRecursion() throws Exception {
    final String proj1 = "Project1";
    final String proj2 = "Project2";
    final FreeStyleProject project1 = createFreeStyleProject(proj1);
    final FreeStyleProject project2 = createFreeStyleProject(proj2);
    project1.getPublishersList().add(new BuildTrigger(proj2, false));
    project2.getPublishersList().add(new BuildTrigger(proj1, false));
    hudson.rebuildDependencyGraph();

    final BuildForm form1 = new BuildForm(jenkins, new PipelineBuild(null, project1, null));
    assertThat(form1.getDependencies(), hasSize(1));
    assertThat(form1.getDependencies().get(0).getDependencies(), hasSize(0));
  }
  @Test
  public void testConstructor() throws Exception {
    final String proj1 = "Project1";
    final String proj2 = "Project2";
    final FreeStyleProject project1 = createFreeStyleProject(proj1);
    project1.getPublishersList().add(new BuildTrigger(proj2, false));
    hudson.rebuildDependencyGraph();
    final FreeStyleBuild build1 = buildAndAssertSuccess(project1);
    waitUntilNoActivity();

    final PipelineBuild pb = new PipelineBuild(build1, project1, null);
    final BuildForm bf = new BuildForm(jenkins, pb);

    assertThat(bf.getStatus(), is(pb.getCurrentBuildResult()));
  }
  @Test
  public void testGetParameterList() throws Exception {
    final String proj1 = "Project1";
    final String proj2 = "Project2";
    final FreeStyleProject project1 = createFreeStyleProject(proj1);
    project1.getPublishersList().add(new BuildTrigger(proj2, false));

    final List<ParameterDefinition> pds = new ArrayList<ParameterDefinition>();
    pds.add(new StringParameterDefinition("tag", ""));
    pds.add(new StringParameterDefinition("branch", ""));

    project1.addProperty(new ParametersDefinitionProperty(pds));
    hudson.rebuildDependencyGraph();
    final FreeStyleBuild build1 = buildAndAssertSuccess(project1);
    waitUntilNoActivity();
    final ArrayList<String> paramList = new ArrayList<String>();
    paramList.add("tag");
    paramList.add("branch");

    final PipelineBuild pb = new PipelineBuild(build1, project1, null);
    final BuildForm bf = new BuildForm(jenkins, pb);

    assertEquals(paramList, bf.getParameterList());
  }