use of com.thoughtworks.go.config.Resources in project gocd by gocd.
the class ResourcesTest method shouldUnderstandLesserLengthResourcesAsLesser.
@Test
public void shouldUnderstandLesserLengthResourcesAsLesser() {
Resources resourcesA = new Resources();
Resources resourcesB = new Resources();
resourcesA.add(new Resource("xyz"));
resourcesB.add(new Resource("xyz"));
resourcesB.add(new Resource("zzz"));
assertThat(resourcesA.compareTo(resourcesB), is(lessThan(0)));
assertThat(resourcesB.compareTo(resourcesA), is(greaterThan(0)));
}
use of com.thoughtworks.go.config.Resources in project gocd by gocd.
the class ResourcesTest method shouldCompareBasedOnSimilarResourceList.
@Test
public void shouldCompareBasedOnSimilarResourceList() {
Resources resourcesA = new Resources();
Resources resourcesB = new Resources();
resourcesA.add(new Resource("xyz"));
resourcesA.add(new Resource("aaa"));
resourcesB.add(new Resource("xyz"));
resourcesB.add(new Resource("aaa"));
assertThat(resourcesA.compareTo(resourcesB), is(0));
}
use of com.thoughtworks.go.config.Resources in project gocd by gocd.
the class ResourcesTest method shouldClearAndSetPrimitiveAttributes.
@Test
public void shouldClearAndSetPrimitiveAttributes() {
Resources resources = new Resources();
String csv = "a, b, c,d ";
resources.add(new Resource("old_resource"));
assertThat(resources.size(), is(1));
resources.importFromCsv(csv);
assertThat(resources.size(), is(4));
assertThat(resources.exportToCsv(), is("a, b, c, d, "));
}
use of com.thoughtworks.go.config.Resources in project gocd by gocd.
the class ResourcesTest method shouldReturnSortedResourceNamesAsStringRepresention.
@Test
public void shouldReturnSortedResourceNamesAsStringRepresention() {
Resources actual = new Resources();
actual.add(new Resource("jdk1.4"));
actual.add(new Resource("linux"));
actual.add(new Resource("gentoo"));
actual.add(new Resource("jdk1.5"));
actual.add(new Resource("Jdk1.5"));
assertThat(actual.size(), is(4));
assertThat(actual.toString(), is("gentoo | jdk1.4 | jdk1.5 | linux"));
}
use of com.thoughtworks.go.config.Resources in project gocd by gocd.
the class ResourcesTest method shouldNotAllowBlankNames.
@Test
public void shouldNotAllowBlankNames() {
Resources resources = new Resources();
resources.add(new Resource(""));
assertThat(resources.size(), is(0));
resources.add(new Resource(" "));
assertThat(resources.size(), is(0));
}
Aggregations