use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class ConstructorsUnitTest method podamShouldCreateInstancesOfJAXBElementsDeclaredAsInstanceVariablesInAPojo.
@Test
@Title("Podam should be able to create instances of JAXBElements declared as instance variables in a POJO")
public void podamShouldCreateInstancesOfJAXBElementsDeclaredAsInstanceVariablesInAPojo() throws Exception {
PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
JAXBElementPojo<?> pojo = podamInvocationSteps.whenIInvokeTheFactoryForGenericTypeWithSpecificType(JAXBElementPojo.class, podamFactory, String.class);
podamValidationSteps.thePojoMustBeOfTheType(pojo, JAXBElementPojo.class);
podamValidationSteps.thePojoMustBeOfTheType(pojo.getValue(), JAXBElement.class);
podamValidationSteps.thePojoMustBeOfTheType(pojo.getValue().getName(), QName.class);
podamValidationSteps.thePojoMustBeOfTheType(pojo.getValue().getValue(), String.class);
}
use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class ReadOnlyComplexTypesTest method podamShouldFillReadOnlyTypes.
@Test
@Title("Podam should fill in read-only POJOs")
public void podamShouldFillReadOnlyTypes() throws Exception {
PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
ReadOnlyComplexTypesPojo pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(ReadOnlyComplexTypesPojo.class, podamFactory);
podamValidationSteps.thePojoMustBeOfTheType(pojo, ReadOnlyComplexTypesPojo.class);
podamValidationSteps.theArrayOfTheGivenTypeShouldNotBeNullOrEmptyAndContainElementsOfTheRightType(pojo.getArray(), String.class);
podamValidationSteps.theCollectionShouldNotBeNullOrEmptyAndContainElementsOfType(pojo.getList(), Integer.class);
podamValidationSteps.theMapShouldNotBeNullOrEmptyAndContainElementsOfType(pojo.getMap(), Long.class, String.class);
podamValidationSteps.thePojoMustBeOfTheType(pojo.getValue(), ReadOnlyComplexTypesPojo.Value.class);
podamValidationSteps.thePojoMustBeOfTheType(pojo.getValue().getValue(), String.class);
}
use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class ReadOnlyComplexTypesTest method podamShouldFillInPojosWhichContainInternalLoops.
@Test
@Title("Podam should fill in POJOs which contain internal loops (e.g. objects that reference parents)")
public void podamShouldFillInPojosWhichContainInternalLoops() throws Exception {
PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
BeanContextServicesSupport pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(BeanContextServicesSupport.class, podamFactory);
podamValidationSteps.thePojoMustBeOfTheType(pojo, BeanContextServicesSupport.class);
}
use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class ConstructorsUnitTest method podamShouldHandleGenericsInSettersDuringPojoInstantiation.
@Test
@Title("Podam should handle generics in setters during Pojo instantiation")
public void podamShouldHandleGenericsInSettersDuringPojoInstantiation() throws Exception {
PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
GenericInSetterPojo pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(GenericInSetterPojo.class, podamFactory);
podamValidationSteps.thePojoMustBeOfTheType(pojo, GenericInSetterPojo.class);
podamValidationSteps.theCollectionShouldNotBeNullOrEmptyAndContainElementsOfType(pojo.getVector(), String.class);
}
use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class ConstructorsUnitTest method podamShouldHandleConstructorsWithGenericArraysDuringPojoInstantiation.
@Test
@Title("Podam should handle constructors with generic arrays during Pojo instantiation")
public void podamShouldHandleConstructorsWithGenericArraysDuringPojoInstantiation() {
PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
GenericArrayInConstructorPojo<?> pojo = podamInvocationSteps.whenIInvokeTheFactoryForGenericTypeWithSpecificType(GenericArrayInConstructorPojo.class, podamFactory, String.class);
podamValidationSteps.thePojoMustBeOfTheType(pojo, GenericArrayInConstructorPojo.class);
podamValidationSteps.theArrayOfTheGivenTypeShouldNotBeNullOrEmptyAndContainElementsOfTheRightType(pojo.getArray(), String.class);
}
Aggregations