use of com.thoughtworks.go.domain.materials.ValidationBean in project gocd by gocd.
the class BackgroundEmailSenderTest method shouldReturnWhateverTheOtherSenderReturnsIfSendingDoesNotTimeout.
@Test
public void shouldReturnWhateverTheOtherSenderReturnsIfSendingDoesNotTimeout() {
final ValidationBean validationBean = ValidationBean.valid();
mockery.checking(new Expectations() {
{
one(sender).send("Subject", "body", "to@someone");
will(returnValue(validationBean));
}
});
BackgroundMailSender background = new BackgroundMailSender(sender, 1000);
ValidationBean returned = background.send("Subject", "body", "to@someone");
assertThat(returned, same(validationBean));
}
use of com.thoughtworks.go.domain.materials.ValidationBean in project gocd by gocd.
the class SvnCommandRemoteTest method shouldMaskPassword_CheckConnection.
@Test
public void shouldMaskPassword_CheckConnection() {
ValidationBean goodResponse = command.checkConnection();
assertThat(goodResponse.isValid(), Is.is(true));
assertThat("Plain text password detected!", goodResponse.getError().contains(HARRYS_PASSWORD), Is.is(false));
ValidationBean badResponse = badUserNameCommand().checkConnection();
assertThat(badResponse.isValid(), Is.is(false));
assertThat("Plain text password detected!", badResponse.getError().contains(HARRYS_PASSWORD), Is.is(false));
badResponse = badPasswordCommand().checkConnection();
assertThat(badResponse.isValid(), Is.is(false));
assertThat("Plain text password detected!", badResponse.getError().contains("some_bad_password"), Is.is(false));
badResponse = badUrlCommand().checkConnection();
assertThat(badResponse.isValid(), Is.is(false));
assertThat("Plain text password detected!", badResponse.getError().contains(HARRYS_PASSWORD), Is.is(false));
}
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 LengthValidatorTest method shouldReturnValidWhenNoInput.
@Test
public void shouldReturnValidWhenNoInput() {
LengthValidator lengthValidator = new LengthValidator(2);
ValidationBean validationBean = lengthValidator.validate(null);
assertThat(validationBean.isValid(), is(true));
}
use of com.thoughtworks.go.domain.materials.ValidationBean in project gocd by gocd.
the class LengthValidatorTest method shouldReturnValidWhenLengthDoesNotExceeds.
@Test
public void shouldReturnValidWhenLengthDoesNotExceeds() {
LengthValidator lengthValidator = new LengthValidator(2);
ValidationBean validationBean = lengthValidator.validate("ab");
assertThat(validationBean.isValid(), is(true));
}
Aggregations