Search in sources :

Example 1 with ValidatedPatternPojo

use of uk.co.jemos.podam.test.dto.ValidatedPatternPojo in project podam by devopsfolks.

the class ValidatedPojoTest method podamShouldAllowValidationAnnotationsCustomization.

@Test
@Title("Podam should allow validation annotations customization")
public void podamShouldAllowValidationAnnotationsCustomization() throws Exception {
    AttributeStrategy<?> strategy = new PatternStrategy();
    PodamFactory podamFactory = podamFactorySteps.givenAPodamFactoryWithCustomStrategy(Pattern.class, strategy);
    ValidatedPatternPojo pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(ValidatedPatternPojo.class, podamFactory);
    podamValidationSteps.thePojoMustBeOfTheType(pojo, ValidatedPatternPojo.class);
    podamValidationSteps.thePojoMustBeOfTheType(pojo.getNumber(), String.class);
    podamValidationSteps.thePojoMustBeOfTheType(pojo.getIdentifier(), String.class);
    Validator validator = podamFactorySteps.givenAJavaxValidator();
    validatorSteps.thePojoShouldNotViolateAnyValidations(validator, pojo);
    podamFactorySteps.removeCustomStrategy(podamFactory, Pattern.class);
}
Also used : PodamFactory(uk.co.jemos.podam.api.PodamFactory) ValidatedPatternPojo(uk.co.jemos.podam.test.dto.ValidatedPatternPojo) PatternStrategy(uk.co.jemos.podam.test.strategies.PatternStrategy) Validator(javax.validation.Validator) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

Aggregations

Validator (javax.validation.Validator)1 Title (net.thucydides.core.annotations.Title)1 Test (org.junit.Test)1 PodamFactory (uk.co.jemos.podam.api.PodamFactory)1 ValidatedPatternPojo (uk.co.jemos.podam.test.dto.ValidatedPatternPojo)1 PatternStrategy (uk.co.jemos.podam.test.strategies.PatternStrategy)1