use of com.thoughtworks.go.domain.materials.ValidationBean in project gocd by gocd.
the class P4MaterialTestBase method shouldCheckConnection.
@Test
public void shouldCheckConnection() throws Exception {
P4Material p4Material = new P4Material("localhost:9876", "p4view");
p4Material.setPassword("secret");
p4Material.setUseTickets(false);
ValidationBean validation = p4Material.checkConnection(new TestSubprocessExecutionContext());
assertThat(validation.isValid(), is(false));
assertThat(validation.getError(), containsString("Unable to connect to server localhost:9876"));
assertThat(validation.getError(), not(containsString("secret")));
}
use of com.thoughtworks.go.domain.materials.ValidationBean in project gocd by gocd.
the class PresenceValidatorTest method shouldRenderErrorWhenStringIsBlank.
@Test
public void shouldRenderErrorWhenStringIsBlank() throws Exception {
ValidationBean validation = new PresenceValidator("String must be non-blank").validate("");
assertThat(validation.isValid(), is(false));
validation = new PresenceValidator("String must be non-blank").validate(null);
assertThat(validation.isValid(), is(false));
validation = new PresenceValidator("String must be non-blank").validate(" ");
assertThat(validation.isValid(), is(false));
validation = new PresenceValidator("String must be non-blank").validate(" \t\n ");
assertThat(validation.isValid(), is(false));
}
use of com.thoughtworks.go.domain.materials.ValidationBean in project gocd by gocd.
the class LengthValidatorTest method shouldReturnInvalidWhenLengthExceeds.
@Test
public void shouldReturnInvalidWhenLengthExceeds() {
LengthValidator lengthValidator = new LengthValidator(2);
ValidationBean validationBean = lengthValidator.validate("abc");
assertThat(validationBean.isValid(), is(false));
}
use of com.thoughtworks.go.domain.materials.ValidationBean in project gocd by gocd.
the class PipelineGroupValidatorTest method shouldValidateNormalPipelineGroupName.
@Test
public void shouldValidateNormalPipelineGroupName() {
ValidationBean validationBean = Validator.PIPELINEGROUP.validate("pipelineGroupName");
assertThat(validationBean.isValid(), is(true));
}
use of com.thoughtworks.go.domain.materials.ValidationBean in project gocd by gocd.
the class PipelineGroupValidatorTest method shouldRejectEmptyPipelineGroup.
@Test
public void shouldRejectEmptyPipelineGroup() {
ValidationBean validationBean = Validator.PIPELINEGROUP.validate(null);
assertThat(validationBean.isValid(), is(true));
}
Aggregations