use of com.thoughtworks.go.config.ParamConfig in project gocd by gocd.
the class ParamsConfigTest method getIndex.
@Test
public void getIndex() {
paramsConfig = new ParamsConfig();
ParamConfig one = new ParamConfig("name", "value");
paramsConfig.add(one);
ParamConfig two = new ParamConfig("other", "other-value");
paramsConfig.add(two);
assertThat(paramsConfig.getIndex("other"), is(1));
assertThat(paramsConfig.getIndex("name"), is(0));
}
use of com.thoughtworks.go.config.ParamConfig in project gocd by gocd.
the class ParamsConfigTest method shouldThrowAnErrorWhenDuplicateNameIsInserted.
@Test
public void shouldThrowAnErrorWhenDuplicateNameIsInserted() {
paramsConfig = new ParamsConfig();
ParamConfig one = new ParamConfig("name", "value");
paramsConfig.add(one);
ParamConfig two = new ParamConfig("name", "other-value");
paramsConfig.add(two);
paramsConfig.validate(context);
assertThat(one.errors().isEmpty(), is(false));
assertThat(one.errors().firstError(), contains("Param name 'name' is not unique for pipeline 'some-pipeline'."));
assertThat(two.errors().isEmpty(), is(false));
assertThat(two.errors().firstError(), contains("Param name 'name' is not unique for pipeline 'some-pipeline'."));
}
Aggregations