Search in sources :

Example 1 with ValidatedPojo

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

the class ValidatedPojoTest method podamShouldFulfillMostOfTheJavaxValidationFramework.

@Test
@Title("Podam should be able to fulfill most of the javax Validation framework")
public void podamShouldFulfillMostOfTheJavaxValidationFramework() throws Exception {
    AttributeStrategy<?> strategy = new EmailStrategy();
    PodamFactory podamFactory = podamFactorySteps.givenAPodamFactoryWithCustomStrategy(Email.class, strategy);
    ValidatedPojo pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(ValidatedPojo.class, podamFactory);
    podamValidationSteps.theObjectShouldNotBeNull(pojo);
    podamValidationSteps.theObjectShouldNotBeNull(pojo.getBoolFalse());
    podamValidationSteps.theObjectShouldNotBeNull(pojo.getBoolTrue());
    podamValidationSteps.theStringFieldCannotBeNullOrEmpty(pojo.getFilledString());
    podamValidationSteps.theObjectShouldBeNull(pojo.getEmptyString());
    podamValidationSteps.theStringFieldCannotBeNullOrEmpty(pojo.getNotEmptyString());
    podamValidationSteps.theStringFieldCannotBeNullOrEmpty(pojo.getNotBlankString());
    podamValidationSteps.theObjectShouldNotBeNull(pojo.getDecimalDouble());
    podamValidationSteps.theObjectShouldNotBeNull(pojo.getDecimalFloat());
    podamValidationSteps.theObjectShouldNotBeNull(pojo.getDecimalString());
    podamValidationSteps.theObjectShouldNotBeNull(pojo.getLongNumber());
    podamValidationSteps.theObjectShouldNotBeNull(pojo.getIntNumber());
    podamValidationSteps.theObjectShouldNotBeNull(pojo.getBigIntNumber());
    podamValidationSteps.theObjectShouldNotBeNull(pojo.getShortNumber());
    podamValidationSteps.theObjectShouldNotBeNull(pojo.getByteNumber());
    podamValidationSteps.theObjectShouldNotBeNull(pojo.getIntString());
    podamValidationSteps.theObjectShouldNotBeNull(pojo.getFractionDecimal());
    podamValidationSteps.theObjectShouldNotBeNull(pojo.getFractionString());
    podamValidationSteps.theObjectShouldNotBeNull(pojo.getPastDate());
    podamValidationSteps.theObjectShouldNotBeNull(pojo.getFutureCalendar());
    podamValidationSteps.theObjectShouldNotBeNull(pojo.getSizedString());
    podamValidationSteps.theObjectShouldNotBeNull(pojo.getMaxCollection());
    podamValidationSteps.theObjectShouldNotBeNull(pojo.getMinCollection());
    podamValidationSteps.theObjectShouldNotBeNull(pojo.getDefaultCollection());
    podamValidationSteps.theObjectShouldNotBeNull(pojo.getDefaultMap());
    podamValidationSteps.theObjectShouldNotBeNull(pojo.getEmail());
    podamValidationSteps.theObjectShouldBeNull(pojo.getIdentifier());
    Validator validator = podamFactorySteps.givenAJavaxValidator();
    validatorSteps.thePojoShouldNotViolateAnyValidations(validator, pojo);
    podamFactorySteps.removeCustomStrategy(podamFactory, Email.class);
}
Also used : PodamFactory(uk.co.jemos.podam.api.PodamFactory) EmailStrategy(uk.co.jemos.podam.test.strategies.EmailStrategy) ValidatedPojo(uk.co.jemos.podam.test.dto.ValidatedPojo) 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 ValidatedPojo (uk.co.jemos.podam.test.dto.ValidatedPojo)1 EmailStrategy (uk.co.jemos.podam.test.strategies.EmailStrategy)1