Search in sources :

Example 1 with NoMoreInteractions

use of org.mockito.internal.verification.NoMoreInteractions in project gocd by gocd.

the class PipelineSchedulerTest method shouldReturn404WhenVariableIsNotInConfigScope.

@Test
public void shouldReturn404WhenVariableIsNotInConfigScope() {
    when(configService.hasPipelineNamed(new CaseInsensitiveString("blahPipeline"))).thenReturn(true);
    when(configService.hasVariableInScope("blahPipeline", "blahVariable")).thenReturn(false);
    OperationResult operationResult = mock(OperationResult.class);
    final HashMap<String, String> revisions = new HashMap<>();
    scheduler.manualProduceBuildCauseAndSave("blahPipeline", Username.ANONYMOUS, new ScheduleOptions(revisions, Collections.singletonMap("blahVariable", "blahValue"), new HashMap<>()), operationResult);
    //noinspection unchecked
    verify(buildCauseProducerService, new NoMoreInteractions()).manualSchedulePipeline(any(Username.class), any(CaseInsensitiveString.class), any(ScheduleOptions.class), any(OperationResult.class));
    verify(operationResult).notFound("Variable 'blahVariable' has not been configured for pipeline 'blahPipeline'", "Variable 'blahVariable' has not been configured for pipeline 'blahPipeline'", HealthStateType.general(HealthStateScope.forPipeline("blahPipeline")));
}
Also used : HashMap(java.util.HashMap) Username(com.thoughtworks.go.server.domain.Username) HttpOperationResult(com.thoughtworks.go.server.service.result.HttpOperationResult) OperationResult(com.thoughtworks.go.server.service.result.OperationResult) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) NoMoreInteractions(org.mockito.internal.verification.NoMoreInteractions) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.Test)

Aggregations

CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)1 Username (com.thoughtworks.go.server.domain.Username)1 HttpOperationResult (com.thoughtworks.go.server.service.result.HttpOperationResult)1 OperationResult (com.thoughtworks.go.server.service.result.OperationResult)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1 NoMoreInteractions (org.mockito.internal.verification.NoMoreInteractions)1