Search in sources :

Example 11 with PodamFactory

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());
}
Also used : PodamFactory(uk.co.jemos.podam.api.PodamFactory) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

Example 12 with PodamFactory

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);
}
Also used : PodamFactory(uk.co.jemos.podam.api.PodamFactory) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

Example 13 with PodamFactory

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);
}
Also used : PodamFactory(uk.co.jemos.podam.api.PodamFactory) DataHandler(javax.activation.DataHandler) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

Example 14 with PodamFactory

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);
}
Also used : PodamFactory(uk.co.jemos.podam.api.PodamFactory) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

Example 15 with PodamFactory

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;
}
Also used : PodamFactory(uk.co.jemos.podam.api.PodamFactory)

Aggregations

PodamFactory (uk.co.jemos.podam.api.PodamFactory)130 Test (org.junit.Test)127 Title (net.thucydides.core.annotations.Title)126 Validator (javax.validation.Validator)4 DataProviderStrategy (uk.co.jemos.podam.api.DataProviderStrategy)3 Calendar (java.util.Calendar)2 GregorianCalendar (java.util.GregorianCalendar)2 AbstractRandomDataProviderStrategy (uk.co.jemos.podam.api.AbstractRandomDataProviderStrategy)2 PodamFactoryImpl (uk.co.jemos.podam.api.PodamFactoryImpl)2 PojoWithMapsAndCollections (uk.co.jemos.podam.test.dto.PojoWithMapsAndCollections)2 SimplePojoToTestSetters (uk.co.jemos.podam.test.dto.SimplePojoToTestSetters)2 GenericCollectionsConstructorPojo (uk.co.jemos.podam.test.dto.issue123.GenericCollectionsConstructorPojo)2 BeanContextServicesSupport (java.beans.beancontext.BeanContextServicesSupport)1 InputStream (java.io.InputStream)1 BigDecimal (java.math.BigDecimal)1 URL (java.net.URL)1 Timestamp (java.sql.Timestamp)1 Currency (java.util.Currency)1 Date (java.util.Date)1 Observable (java.util.Observable)1