use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class AbnormalPojosTest method invokingPodamOnaPojoWithPrivateNoArgumentsConstructorShouldReturnANonEmptyPojo.
@Test
@Title("Invoking Podam on a POJO with a private, no arguments constructor, should return a non null POJO")
public void invokingPodamOnaPojoWithPrivateNoArgumentsConstructorShouldReturnANonEmptyPojo() throws Exception {
PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
PrivateNoArgConstructorPojo pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(PrivateNoArgConstructorPojo.class, podamFactory);
podamValidationSteps.theObjectShouldNotBeNull(pojo);
podamValidationSteps.theIntFieldShouldNotBeZero(pojo.getIntField());
}
use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class AbnormalPojosTest method podamShouldThrowAnExceptionIfAPojoContainsInvalidGettersOrSetters.
@Test(expected = PodamMockeryException.class)
@Title("Podam should throw an exception if a POJO contains invalid getters or setters")
public void podamShouldThrowAnExceptionIfAPojoContainsInvalidGettersOrSetters() throws Exception {
PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
BadlyTypedPojo pojo = podamFactory.manufacturePojo(BadlyTypedPojo.class);
Assert.assertNotNull("Manufacturing failed", pojo);
}
use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class AbnormalPojosTest method podamShouldHandlePojosWithAMixOfCircularAndNonCircularConstructors.
@Test
@Title("Invoking Podam on a POJO with both circular and non circular constructors (e.g. javax.activation.DataHandler) should lead to a non empty POJO")
public void podamShouldHandlePojosWithAMixOfCircularAndNonCircularConstructors() throws Exception {
PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
DataHandler pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(DataHandler.class, podamFactory);
podamValidationSteps.theObjectShouldNotBeNull(pojo);
}
use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class AbnormalPojosTest method podamShouldGenerateANonNullPojoForAbstractTypesWithConcreteImplementation.
@Test
@Title("Podam should generate a non null POJO for Abstract types with a concrete type")
public void podamShouldGenerateANonNullPojoForAbstractTypesWithConcreteImplementation() throws Exception {
PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
podamStrategySteps.addOrReplaceSpecific(podamFactory, AbstractTestPojo.class, ConcreteTestPojo.class);
AbstractTestPojo pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(AbstractTestPojo.class, podamFactory);
podamValidationSteps.thePojoMustBeOfTheType(pojo, ConcreteTestPojo.class);
podamStrategySteps.removeSpecific(podamFactory, AbstractTestPojo.class);
AbstractTestPojo pojo2 = podamInvocationSteps.whenIInvokeTheFactoryForClass(AbstractTestPojo.class, podamFactory);
podamValidationSteps.thePojoShouldBeNull(pojo2);
}
use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class MultipleInterfacesInheritanceTest method provideCustomisedPodamFactory.
//-------------> Private methods
private PodamFactory provideCustomisedPodamFactory() throws Exception {
TrackingExternalFactory externalFactory = podamFactorySteps.givenATrackingExternalFactory();
CustomDataProviderStrategy customDataProviderStrategy = podamFactorySteps.givenACustomDataProviderStrategy();
PodamFactory podamFactory = podamFactorySteps.givenAPodamFactoryWithExternalFactoryAndCustomStrategy(externalFactory, customDataProviderStrategy);
return podamFactory;
}
Aggregations