use of uk.co.jemos.podam.test.dto.ValidationPojoForStringWithSizeAndNoMax in project podam by devopsfolks.
the class ValidatedPojoTest method whenMaxLengthIsNotSpecifiedInSizeAnnotationPodamShouldAssignASensibleDefault.
@Test
@Title("When the @Size annotation doesn't have a max length specified, Podam should assign a sensible value")
public void whenMaxLengthIsNotSpecifiedInSizeAnnotationPodamShouldAssignASensibleDefault() throws Exception {
PodamFactory podamFactory = podamFactorySteps.givenAPodamWithACustomTypeManufacturer(String.class, stringTypeManufacturer);
ValidationPojoForStringWithSizeAndNoMax pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(ValidationPojoForStringWithSizeAndNoMax.class, podamFactory);
podamValidationSteps.theObjectShouldNotBeNull(pojo);
podamValidationSteps.theCollectionShouldBeEmpty(stringTypeManufacturer.calls);
Validator validator = podamFactorySteps.givenAJavaxValidator();
validatorSteps.thePojoShouldNotViolateAnyValidations(validator, pojo);
}
use of uk.co.jemos.podam.test.dto.ValidationPojoForStringWithSizeAndNoMax in project podam by devopsfolks.
the class ValidatedPojoTest method whenTheAnnotationStrategyAndTheTypeManufacturerAreSpecifiedTheFormerHasPrecedence.
@Test
@Title("When the AnnotationStrategy and the TypeManufacturer are specified, the former has precedence")
public void whenTheAnnotationStrategyAndTheTypeManufacturerAreSpecifiedTheFormerHasPrecedence() throws Exception {
AnnotationStrategy annotationStrategy = new AnnotationStrategy();
PodamFactory podamFactory = podamFactorySteps.givenAPodamFactoryWithCustomStrategy(Size.class, annotationStrategy);
podamFactorySteps.addCustomTypeManufacturer(podamFactory, String.class, stringTypeManufacturer);
ValidationPojoForStringWithSizeAndNoMax pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(ValidationPojoForStringWithSizeAndNoMax.class, podamFactory);
podamValidationSteps.theObjectShouldNotBeNull(pojo);
podamValidationSteps.theCollectionShouldBeEmpty(stringTypeManufacturer.calls);
podamValidationSteps.theCollectionShouldNotBeNullOrEmptyAndShouldHaveExactlyTheExpectedNumberOfElements(annotationStrategy.getRecordedCalls(), List.class, 2);
}
Aggregations