use of com.thoughtworks.go.domain.materials.ValidationBean in project gocd by gocd.
the class LengthValidatorTest method shouldReturnValidWhenEmptyInput.
@Test
public void shouldReturnValidWhenEmptyInput() {
LengthValidator lengthValidator = new LengthValidator(2);
ValidationBean validationBean = lengthValidator.validate("");
assertThat(validationBean.isValid(), is(true));
}
use of com.thoughtworks.go.domain.materials.ValidationBean in project gocd by gocd.
the class PipelineGroupValidatorTest method shouldRejectWhiteSpace.
@Test
public void shouldRejectWhiteSpace() {
ValidationBean validationBean = Validator.PIPELINEGROUP.validate("pipeline GroupName");
assertThat(validationBean.isValid(), is(false));
assertThat(validationBean.getError(), Is.is(PipelineGroupValidator.ERRORR_MESSAGE));
}
use of com.thoughtworks.go.domain.materials.ValidationBean in project gocd by gocd.
the class PresenceValidatorTest method shouldNotRenderErrorWhenStringIsNotBlank.
@Test
public void shouldNotRenderErrorWhenStringIsNotBlank() throws Exception {
ValidationBean validation = new PresenceValidator("String must be non-blank").validate("foo");
assertThat(validation.isValid(), is(true));
}
use of com.thoughtworks.go.domain.materials.ValidationBean in project gocd by gocd.
the class BackgroundEmailSenderTest method shouldReturnNotValidIfSendingTimesout.
@Test
public void shouldReturnNotValidIfSendingTimesout() {
BackgroundMailSender background = new BackgroundMailSender(neverReturns, 1);
ValidationBean validationBean = background.send("Subject", "body", "to@someone");
assertThat(validationBean.isValid(), is(false));
assertThat(validationBean.getError(), containsString("Failed to send an email. Please check the GoCD server logs for any extra information that might be present."));
}
use of com.thoughtworks.go.domain.materials.ValidationBean in project gocd by gocd.
the class GoSmtpMailSenderTest method shouldNotSendTestEmailToSmtpServerIfTlsConfiguredIncorrect.
@Test
public void shouldNotSendTestEmailToSmtpServerIfTlsConfiguredIncorrect() {
GoSmtpMailSender sender = new GoSmtpMailSender(hostName, 25, username, password, true, from, to);
ValidationBean bean = sender.send(subject, body, to);
assertThat(bean, is(not(ValidationBean.valid())));
}
Aggregations