use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class ConstructorsUnitTest method podamShouldBeAbleToManufacturePojosWhichContainImmutableCollections.
@Test
@Title("Podam should be able to manufacture POJOs which contain immutable collections")
public void podamShouldBeAbleToManufacturePojosWhichContainImmutableCollections() throws Exception {
PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
ImmutableDefaultFieldsPojo model = podamInvocationSteps.whenIInvokeTheFactoryForClass(ImmutableDefaultFieldsPojo.class, podamFactory);
podamValidationSteps.thePojoMustBeOfTheType(model, ImmutableDefaultFieldsPojo.class);
podamValidationSteps.theCollectionShouldNotBeNullOrEmptyAndShouldHaveExactlyTheExpectedNumberOfElements(model.getList(), String.class, podamFactory.getStrategy().getNumberOfCollectionElements(model.getList().getClass()));
podamValidationSteps.theMapShouldNotBeNullOrEmptyAndShouldHaveExactlyTheExpectedNumberOfElements(model.getMap(), String.class, Integer.class, podamFactory.getStrategy().getNumberOfCollectionElements(model.getMap().getClass()));
}
use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class ConstructorsUnitTest method podamShouldHandleGenericsInStaticConstructorsDuringPojoInstantiation.
@Test
@Title("Podam should handle generics in static constructors during POJO instantiation")
public void podamShouldHandleGenericsInStaticConstructorsDuringPojoInstantiation() throws Exception {
PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
GenericInStaticConstructorPojo pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(GenericInStaticConstructorPojo.class, podamFactory);
podamValidationSteps.thePojoMustBeOfTheType(pojo, GenericInStaticConstructorPojo.class);
podamValidationSteps.theCollectionShouldNotBeNullOrEmptyAndContainElementsOfType(pojo.getVector(), String.class);
}
use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class ClassUnitTest method podamShouldHandleTheManufacturingOfGenericPojos.
@Test
@Title("Podam should handle the manufacturing of generic POJOs")
public void podamShouldHandleTheManufacturingOfGenericPojos() throws Exception {
PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
ClassGenericPojo<?> pojo = podamInvocationSteps.whenIInvokeTheFactoryForGenericTypeWithSpecificType(ClassGenericPojo.class, podamFactory, String.class);
podamValidationSteps.thePojoMustBeOfTheType(pojo, ClassGenericPojo.class);
podamValidationSteps.thePojoMustBeOfTheType(pojo.getClazz(), Class.class);
podamValidationSteps.theTwoObjectsShouldBeEqual(String.class, pojo.getClazz());
}
use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class ClassUnitTest method podamShouldHandleTheManufacturingOfPojosWithGenericTypesInTheConstructor.
@Test
@Title("Podam should handle the manufacturing of POJOs with generic types in constructor")
public void podamShouldHandleTheManufacturingOfPojosWithGenericTypesInTheConstructor() throws Exception {
PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
ClassGenericConstructorPojo<?> pojo = podamInvocationSteps.whenIInvokeTheFactoryForGenericTypeWithSpecificType(ClassGenericConstructorPojo.class, podamFactory, String.class);
podamValidationSteps.thePojoMustBeOfTheType(pojo, ClassGenericConstructorPojo.class);
podamValidationSteps.thePojoMustBeOfTheType(pojo.getClazz(), Class.class);
podamValidationSteps.theTwoObjectsShouldBeEqual(String.class, pojo.getClazz());
}
use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class PodamFactoryBasicTypesTest method podamShouldFillPojoWithEnums.
@Test
@Title("Podam should fill in POJOs with Enums")
public void podamShouldFillPojoWithEnums() throws Exception {
PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
EnumsPojo pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(EnumsPojo.class, podamFactory);
podamValidationSteps.thePojoMustBeOfTheType(pojo, EnumsPojo.class);
ExternalRatePodamEnum ratePodamExternal = pojo.getRatePodamExternal();
podamValidationSteps.thePojoMustBeOfTheType(ratePodamExternal, ExternalRatePodamEnum.class);
EnumsPojo.RatePodamInternal ratePodamInternal = pojo.getRatePodamInternal();
podamValidationSteps.thePojoMustBeOfTheType(ratePodamInternal, EnumsPojo.RatePodamInternal.class);
EnumsPojo.EmptyPodamInternal emptyPodamInternal = pojo.getEmptyPodamInternal();
podamValidationSteps.thePojoShouldBeNull(emptyPodamInternal);
}
Aggregations