use of com.thoughtworks.go.server.domain.MaterialForScheduling in project gocd by gocd.
the class PipelineTriggerServiceIntegrationTest method shouldReturnErrorIfThePipelineBeingScheduledDoesNotContainTheMaterialsSetInRequest.
@Test
public void shouldReturnErrorIfThePipelineBeingScheduledDoesNotContainTheMaterialsSetInRequest() {
assertThat(triggerMonitor.isAlreadyTriggered(pipelineName), is(false));
PipelineScheduleOptions pipelineScheduleOptions = new PipelineScheduleOptions();
MaterialForScheduling material = new MaterialForScheduling("non-existant-material", "r1");
pipelineScheduleOptions.getMaterials().add(material);
pipelineTriggerService.schedule(pipelineName, pipelineScheduleOptions, admin, result);
assertThat(result.isSuccess(), is(false));
assertThat(result.fullMessage(), is(String.format("Request to schedule pipeline rejected { Pipeline '%s' does not contain the following material(s): [non-existant-material]. }", pipelineName)));
assertThat(result.httpCode(), is(422));
assertThat(triggerMonitor.isAlreadyTriggered(pipelineName), is(false));
}
Aggregations