use of com.thoughtworks.go.config.Resources in project gocd by gocd.
the class ResourcesTest method shouldValidateTree.
@Test
public void shouldValidateTree() {
Resource resource1 = new Resource("a#");
Resource resource2 = new Resource("b");
Resources resources = new Resources(resource1, resource2);
resources.validateTree(PipelineConfigSaveValidationContext.forChain(true, "group", new PipelineConfig()));
assertThat(resource1.errors().size(), is(1));
assertThat(resource1.errors().firstError(), is(String.format("Resource name 'a#' is not valid. Valid names much match '%s'", Resource.VALID_REGEX)));
assertThat(resource2.errors().isEmpty(), is(true));
}
use of com.thoughtworks.go.config.Resources in project gocd by gocd.
the class ResourcesTest method shouldNotAddDuplicateResources.
@Test
public void shouldNotAddDuplicateResources() {
Resources expected = new Resources();
expected.add(new Resource("jdk1.4"));
expected.add(new Resource("jdk1.5"));
Resources actual = new Resources();
actual.add(new Resource("jdk1.4"));
actual.add(new Resource("jdk1.5"));
actual.add(new Resource("Jdk1.5"));
assertThat(expected, is(actual));
}
use of com.thoughtworks.go.config.Resources in project gocd by gocd.
the class ResourcesTest method shouldReturnListOfResoucesAsCommaSeperatedList.
@Test
public void shouldReturnListOfResoucesAsCommaSeperatedList() {
Resources actual = new Resources();
actual.add(new Resource(" a "));
actual.add(new Resource(" b"));
actual.add(new Resource("c"));
assertThat(actual.exportToCsv(), is("a, b, c, "));
}
use of com.thoughtworks.go.config.Resources in project gocd by gocd.
the class ResourcesTest method shouldNotBeAbleToAddResourceWithWhiteSpaceAsName.
@Test
public void shouldNotBeAbleToAddResourceWithWhiteSpaceAsName() {
Resources actual = new Resources();
actual.add(new Resource(" "));
assertThat(actual.size(), is(0));
}
use of com.thoughtworks.go.config.Resources in project gocd by gocd.
the class ResourcesTest method shouldHaveNiceConvenienceConstructorThatDoesSomeNiftyParsing.
@Test
public void shouldHaveNiceConvenienceConstructorThatDoesSomeNiftyParsing() {
Resources actual = new Resources("mou, fou");
assertThat(actual.toString(), is("fou | mou"));
}
Aggregations