use of org.talend.daikon.properties.ValidationResultMutable in project components by Talend.
the class SalesforceConnectionPropertiesTest method testValidateTestConnection.
@Test
public void testValidateTestConnection() throws Exception {
properties.init();
Form wizardForm = properties.getForm(SalesforceConnectionProperties.FORM_WIZARD);
try (MockRuntimeSourceOrSinkTestFixture testFixture = new MockRuntimeSourceOrSinkTestFixture(equalTo(properties), createDefaultTestDataset())) {
testFixture.setUp();
// Valid
ValidationResult vr1 = properties.validateTestConnection();
assertEquals(ValidationResult.Result.OK, vr1.getStatus());
assertTrue(wizardForm.isAllowForward());
// Not valid
when(testFixture.runtimeSourceOrSink.validate(any(RuntimeContainer.class))).thenReturn(new ValidationResultMutable().setStatus(ValidationResult.Result.ERROR).setMessage("Error"));
ValidationResult vr2 = properties.validateTestConnection();
assertEquals(ValidationResult.Result.ERROR, vr2.getStatus());
assertFalse(wizardForm.isAllowForward());
}
}
Aggregations