/** Config roundtrip test around pre/post build step */
  public void testConfigRoundtrip() throws Exception {
    MavenModuleSet m = createMavenProject();
    Shell b1 = new Shell("1");
    Shell b2 = new Shell("2");
    m.getPrebuilders().add(b1);
    m.getPostbuilders().add(b2);
    configRoundtrip((Item) m);

    assertEquals(1, m.getPrebuilders().size());
    assertNotSame(b1, m.getPrebuilders().get(Shell.class));
    assertEquals("1", m.getPrebuilders().get(Shell.class).getCommand());

    assertEquals(1, m.getPostbuilders().size());
    assertNotSame(b2, m.getPostbuilders().get(Shell.class));
    assertEquals("2", m.getPostbuilders().get(Shell.class).getCommand());

    for (Result r : new Result[] {Result.SUCCESS, Result.UNSTABLE, Result.FAILURE}) {
      m.setRunPostStepsIfResult(r);
      configRoundtrip((Item) m);
      assertEquals(r, m.getRunPostStepsIfResult());
    }
  }
  @Bug(17177)
  public void testCorrectResultInPostStepAfterFailedPreBuildStep() throws Exception {
    MavenModuleSet p = createSimpleProject();
    MavenInstallation mi = configureDefaultMaven();
    p.setMaven(mi.getName());
    p.setGoals("initialize");

    Shell pre = new Shell("exit 1"); // must fail to simulate scenario!
    p.getPrebuilders().add(pre);
    ResultExposingBuilder resultExposer = new ResultExposingBuilder();
    p.getPostbuilders().add(resultExposer);

    assertBuildStatus(Result.FAILURE, p.scheduleBuild2(0).get());
    assertEquals(
        "The result passed to the post build step was not the one from the pre build step",
        Result.FAILURE,
        resultExposer.getResult());
  }