@Test
 public void manualSchedulePipeline_canProduceShouldNotgetIntoCyclicLoopWithTriggerMonitor()
     throws Exception {
   OperationResult operationResult = new ServerHealthStateOperationResult();
   buildCauseProducer.manualProduceBuildCauseAndSave(
       MINGLE_PIPELINE_NAME, Username.ANONYMOUS, new ScheduleOptions(), operationResult);
   scheduleHelper.waitForAnyScheduled(5);
   assertThat(operationResult.canContinue(), is(true));
 }
 @Test
 public void shouldScheduleANewPipelineWhenManuallyTrigeredWithNoChanges() throws Exception {
   final HashMap<String, String> revisions = new HashMap<String, String>();
   final HashMap<String, String> environmentVariables = new HashMap<String, String>();
   buildCauseProducer.manualProduceBuildCauseAndSave(
       MINGLE_PIPELINE_NAME,
       Username.ANONYMOUS,
       new ScheduleOptions(revisions, environmentVariables, new HashMap<String, String>()),
       new ServerHealthStateOperationResult());
   assertThat(scheduleHelper.waitForAnyScheduled(5).keySet(), hasItem(MINGLE_PIPELINE_NAME));
 }
  @Test
  public void shouldSchedulePipelineWithManualFirstStageWhenManuallyTriggered() throws Exception {
    configHelper.configureStageAsManualApproval(MINGLE_PIPELINE_NAME, STAGE_NAME);

    svnRepository.checkInOneFile("a.java");
    materialDatabaseUpdater.updateMaterial(svnRepository.material());

    final HashMap<String, String> revisions = new HashMap<String, String>();
    final HashMap<String, String> environmentVariables = new HashMap<String, String>();
    buildCauseProducer.manualProduceBuildCauseAndSave(
        MINGLE_PIPELINE_NAME,
        Username.ANONYMOUS,
        new ScheduleOptions(revisions, environmentVariables, new HashMap<String, String>()),
        new ServerHealthStateOperationResult());

    Map<String, BuildCause> afterLoad = scheduleHelper.waitForAnyScheduled(5);
    assertThat(afterLoad.keySet(), hasItem(MINGLE_PIPELINE_NAME));
    BuildCause cause = afterLoad.get(MINGLE_PIPELINE_NAME);
    assertThat(cause.getBuildCauseMessage(), containsString("Forced by anonymous"));
  }