Search in sources :

Example 6 with ValidationResult

use of com.redhat.service.smartevents.infra.validations.ValidationResult in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class WebhookActionValidatorTest method isValid.

@ParameterizedTest
@MethodSource("validParams")
void isValid(Map<String, String> params) {
    ValidationResult validationResult = validator.isValid(actionWith(params));
    assertThat(validationResult.isValid()).isTrue();
}
Also used : ValidationResult(com.redhat.service.smartevents.infra.validations.ValidationResult) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 7 with ValidationResult

use of com.redhat.service.smartevents.infra.validations.ValidationResult in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class WebhookActionValidatorTest method isInvalidWithNullParametersMap.

@Test
void isInvalidWithNullParametersMap() {
    Action action = new Action();
    action.setType(WebhookAction.TYPE);
    action.setMapParameters(new HashMap<>());
    ValidationResult validationResult = validator.isValid(action);
    assertThat(validationResult.isValid()).isFalse();
}
Also used : Action(com.redhat.service.smartevents.infra.models.gateways.Action) ValidationResult(com.redhat.service.smartevents.infra.validations.ValidationResult) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 8 with ValidationResult

use of com.redhat.service.smartevents.infra.validations.ValidationResult in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class AbstractSourceTest method assertValidationIsInvalid.

protected void assertValidationIsInvalid(T source, String errorMessage) {
    ValidationResult validationResult = getValidator().isValid(source);
    assertThat(validationResult.isValid()).isFalse();
    assertThat(validationResult.getMessage()).startsWith(errorMessage);
}
Also used : ValidationResult(com.redhat.service.smartevents.infra.validations.ValidationResult)

Example 9 with ValidationResult

use of com.redhat.service.smartevents.infra.validations.ValidationResult in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class AwsSqsSourceValidatorTest method isValid.

@ParameterizedTest
@MethodSource("validParams")
void isValid(Map<String, String> params) {
    ValidationResult validationResult = validator.isValid(sourceWith(params));
    assertThat(validationResult.isValid()).isTrue();
}
Also used : ValidationResult(com.redhat.service.smartevents.infra.validations.ValidationResult) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 10 with ValidationResult

use of com.redhat.service.smartevents.infra.validations.ValidationResult in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class SlackSourceValidatorTest method assertIsValid.

private void assertIsValid(Source Source) {
    ValidationResult validationResult = validator.isValid(Source);
    assertThat(validationResult.isValid()).isTrue();
}
Also used : ValidationResult(com.redhat.service.smartevents.infra.validations.ValidationResult)

Aggregations

ValidationResult (com.redhat.service.smartevents.infra.validations.ValidationResult)17 Test (org.junit.jupiter.api.Test)5 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)5 MethodSource (org.junit.jupiter.params.provider.MethodSource)4 Action (com.redhat.service.smartevents.infra.models.gateways.Action)3 QuarkusTest (io.quarkus.test.junit.QuarkusTest)3 GatewayProviderException (com.redhat.service.smartevents.infra.exceptions.definitions.user.GatewayProviderException)1 HibernateConstraintValidatorContext (org.hibernate.validator.constraintvalidation.HibernateConstraintValidatorContext)1