Search in sources :

Example 1 with ValidationContext

use of com.thoughtworks.go.config.ValidationContext in project gocd by gocd.

the class ParamConfigTest method shouldValidateName.

@Test
public void shouldValidateName() {
    ParamConfig paramConfig = new ParamConfig();
    ValidationContext validationContext = mock(ValidationContext.class);
    when(validationContext.getPipeline()).thenReturn(new PipelineConfig(new CaseInsensitiveString("p"), null));
    paramConfig.validateName(new HashMap<>(), validationContext);
    assertThat(paramConfig.errors().on(ParamConfig.NAME), is("Parameter cannot have an empty name for pipeline 'p'."));
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) ParamConfig(com.thoughtworks.go.config.ParamConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) ValidationContext(com.thoughtworks.go.config.ValidationContext) Test(org.junit.Test)

Aggregations

CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)1 ParamConfig (com.thoughtworks.go.config.ParamConfig)1 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)1 ValidationContext (com.thoughtworks.go.config.ValidationContext)1 Test (org.junit.Test)1