use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class ConstructorsUnitTest method podamShouldHandleClassesWithKeyValueGenericTypes.
@Test
@Title("Podam should handle classes with generic Key/Value types")
public void podamShouldHandleClassesWithKeyValueGenericTypes() throws Exception {
PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
DefaultFieldPojo<?, ?> pojo = podamInvocationSteps.whenIInvokeTheFactoryForGenericTypeWithSpecificType(DefaultFieldPojo.class, podamFactory, String.class, Long.class);
podamValidationSteps.thePojoMustBeOfTheType(pojo, DefaultFieldPojo.class);
podamValidationSteps.theMapShouldNotBeNullOrEmptyAndContainElementsOfType(pojo.getMap(), String.class, Long.class);
}
use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class ConstructorsUnitTest method podamShouldManufacturePackagePrivatePojos.
@Test
@Title("Podam should manufacture package private POJOs")
public void podamShouldManufacturePackagePrivatePojos() throws Exception {
PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
PackagePrivatePojo pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(PackagePrivatePojo.class, podamFactory);
podamValidationSteps.thePojoMustBeOfTheType(pojo, PackagePrivatePojo.class);
podamValidationSteps.thePojoMustBeOfTheType(pojo.getValue(), String.class);
}
use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class ConstructorsUnitTest method podamShouldBeAbleToInstantiatePojosWithImmutableCollections.
@Test
@Title("Podam should be able to instantiate POJOs with immutable Collections")
public void podamShouldBeAbleToInstantiatePojosWithImmutableCollections() throws Exception {
PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
ImmutableVector<?> pojo = podamInvocationSteps.whenIInvokeTheFactoryForGenericTypeWithSpecificType(ImmutableVector.class, podamFactory, String.class);
podamValidationSteps.theCollectionShouldBeEmpty(pojo);
}
use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class ExternalFactoryUnitTest method podamShouldNotCreateInstancesOfAnAbstractClassEvenIfPojoHasFullConstructor.
@Test
@Title("Podam should not be able to create instances of an Abstract class even if the POJO has a full constructor")
public void podamShouldNotCreateInstancesOfAnAbstractClassEvenIfPojoHasFullConstructor() throws Exception {
TestExternalFactory externalFactory = (TestExternalFactory) podamFactorySteps.givenAnExternalFactory();
PodamFactory podamFactory = podamFactorySteps.givenAdPodamFactoryWithExternalFactory(externalFactory);
podamValidationSteps.theTwoObjectsShouldBeEqual(podamFactory.getExternalFactory(), externalFactory);
AbstractClass pojo = podamInvocationSteps.whenIInvokeTheFactoryForClassWithFullConstructor(AbstractClass.class, podamFactory);
podamValidationSteps.theObjectShouldBeNull(pojo);
podamValidationSteps.theTwoObjectsShouldBeEqual(1, externalFactory.getFailures().size());
podamValidationSteps.theTwoObjectsShouldBeEqual(AbstractClass.class, externalFactory.getFailures().get(0));
podamValidationSteps.theTwoObjectsShouldBeEqual(1, externalFactory.getFullDataCalls().size());
}
use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class ExternalFactoryUnitTest method podamShouldFillPojoInterfaceAttributeIfFullConstructorSetsItsValue.
@Test
@Title("Podam should fill POJOs and interface attributes if a full constructor sets the interface attribute value")
public void podamShouldFillPojoInterfaceAttributeIfFullConstructorSetsItsValue() throws Exception {
TestExternalFactory externalFactory = (TestExternalFactory) podamFactorySteps.givenAnExternalFactory();
PodamFactory podamFactory = podamFactorySteps.givenAdPodamFactoryWithExternalFactory(externalFactory);
podamValidationSteps.theTwoObjectsShouldBeEqual(podamFactory.getExternalFactory(), externalFactory);
PojoWithInterfaces pojo = podamInvocationSteps.whenIInvokeTheFactoryForClassWithFullConstructor(PojoWithInterfaces.class, podamFactory);
podamValidationSteps.theObjectShouldNotBeNull(pojo);
podamValidationSteps.theTwoObjectsShouldBeEqual(2, externalFactory.getFailures().size());
podamValidationSteps.theTwoObjectsShouldBeEqual(ObjectExt.class, externalFactory.getFailures().get(0));
podamValidationSteps.theTwoObjectsShouldBeEqual(InterfacePojo.class, externalFactory.getFailures().get(1));
podamValidationSteps.theTwoObjectsShouldBeEqual(2, externalFactory.getFullDataCalls().size());
}
Aggregations