use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class AbnormalPojosTest method podamShouldFillEmbeddedAbstractClassesIfAConcreteTypeHasBeenSpecified.
@Test
@Title("Podam should fill embedded abstract classes if a concrete type has been specified")
public void podamShouldFillEmbeddedAbstractClassesIfAConcreteTypeHasBeenSpecified() throws Exception {
PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
podamStrategySteps.addOrReplaceSpecific(podamFactory, AbstractTestPojo.class, ConcreteTestPojo.class);
EmbeddedAbstractFieldTestPojo pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(EmbeddedAbstractFieldTestPojo.class, podamFactory);
podamValidationSteps.thePojoMustBeOfTheType(pojo, EmbeddedAbstractFieldTestPojo.class);
podamValidationSteps.thePojoMustBeOfTheType(pojo.getPojo(), AbstractTestPojo.class);
}
use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class ExtensionsTest method podamShouldCreatePojosInAccordanceWithCustomDataProviderStrategies.
@Test
@Title("Podam should create POJOs in accordance with custom data provider strategies")
public void podamShouldCreatePojosInAccordanceWithCustomDataProviderStrategies() throws Exception {
CustomRandomDataProviderStrategy strategy = podamFactorySteps.givenACustomRandomDataProviderStrategy();
PodamFactory podamFactory = podamFactorySteps.givenAPodamFactoryWithCustomDataProviderStrategy(strategy);
PojoWithMapsAndCollections pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(PojoWithMapsAndCollections.class, podamFactory);
podamValidationSteps.theObjectShouldNotBeNull(pojo);
podamValidationSteps.theArrayOfTheGivenTypeShouldNotBeNullOrEmptyAndContainExactlyTheGivenNumberOfElements(pojo.getArray(), 2, String.class);
podamValidationSteps.theCollectionShouldNotBeNullOrEmptyAndShouldHaveExactlyTheExpectedNumberOfElements(pojo.getList(), Boolean.class, 3);
podamValidationSteps.theMapShouldNotBeNullOrEmptyAndShouldHaveExactlyTheExpectedNumberOfElements(pojo.getMap(), Integer.class, Long.class, 4);
}
use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class InheritanceTest method podamShouldManufactureAllPojosInATreeHierarchy.
@Test
@Title("Podam should manufacture all POJOs in a tree hierarchy")
public void podamShouldManufactureAllPojosInATreeHierarchy() throws Exception {
PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
A pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(A.class, podamFactory);
podamValidationSteps.theObjectShouldNotBeNull(pojo);
B b = pojo.getB();
podamValidationSteps.theObjectShouldNotBeNull(b);
podamValidationSteps.theObjectShouldNotBeNull(b.getCustomValue());
}
use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class MultipleInterfacesInheritanceTest method podamCannotInstantiateInterfaces.
@Test
@Title("Podam cannot instantiate interfaces")
public void podamCannotInstantiateInterfaces() throws Exception {
PodamFactory podamFactory = provideCustomisedPodamFactory();
MultipleInterfacesListPojo<?> pojo = podamInvocationSteps.whenIInvokeTheFactoryForGenericTypeWithSpecificType(MultipleInterfacesListPojo.class, podamFactory, String.class);
podamValidationSteps.theObjectShouldBeNull(pojo);
List<Class<?>> accessed = ((CustomDataProviderStrategy) podamFactory.getStrategy()).getAccessed();
podamValidationSteps.theCollectionShouldNotBeNullOrEmptyAndShouldHaveExactlyTheExpectedNumberOfElements(accessed, Class.class, 1);
podamValidationSteps.theTwoObjectsShouldBeEqual(MultipleInterfacesListPojo.class, accessed.get(0));
}
use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class MultipleInterfacesInheritanceTest method testHolderOfPojoWithMultiInterfaces.
@Test
@Title("Podam will create an instance of a POJO but its interface types won't be instantiated")
public void testHolderOfPojoWithMultiInterfaces() throws Exception {
PodamFactory podamFactory = provideCustomisedPodamFactory();
MultipleInterfacesHolderPojo<?, ?> pojo = podamInvocationSteps.whenIInvokeTheFactoryForGenericTypeWithSpecificType(MultipleInterfacesHolderPojo.class, podamFactory, String.class, Long.class);
podamValidationSteps.theObjectShouldNotBeNull(pojo);
podamValidationSteps.theObjectShouldBeNull(pojo.getList());
podamValidationSteps.theObjectShouldBeNull(pojo.getMap());
List<Class<?>> accessed = ((CustomDataProviderStrategy) podamFactory.getStrategy()).getAccessed();
podamValidationSteps.theTwoObjectsShouldBeEqual(accessed.size(), 2);
podamValidationSteps.theCollectionShouldContainAtLeastOneElementOfType(accessed, MultipleInterfacesListPojo.class);
podamValidationSteps.theCollectionShouldContainAtLeastOneElementOfType(accessed, MultipleInterfacesMapPojo.class);
}
Aggregations