Search in sources :

Example 46 with PodamFactory

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

Example 47 with PodamFactory

use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.

the class ExternalFactoryUnitTest method podamShouldNotcreateInstancesOfNonInstantiableClasses.

@Test
@Title("Podam should not create instances of non-instantiable classes")
public void podamShouldNotcreateInstancesOfNonInstantiableClasses() throws Exception {
    TestExternalFactory externalFactory = (TestExternalFactory) podamFactorySteps.givenAnExternalFactory();
    PodamFactory podamFactory = podamFactorySteps.givenAdPodamFactoryWithExternalFactory(externalFactory);
    podamValidationSteps.theTwoObjectsShouldBeEqual(podamFactory.getExternalFactory(), externalFactory);
    NonInstantiatableClass pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(NonInstantiatableClass.class, podamFactory);
    podamValidationSteps.theObjectShouldBeNull(pojo);
    podamValidationSteps.theTwoObjectsShouldBeEqual(1, externalFactory.getFailures().size());
    podamValidationSteps.theTwoObjectsShouldBeEqual(NonInstantiatableClass.class, externalFactory.getFailures().get(0));
    podamValidationSteps.theTwoObjectsShouldBeEqual(0, externalFactory.getFullDataCalls().size());
}
Also used : PodamFactory(uk.co.jemos.podam.api.PodamFactory) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

Example 48 with PodamFactory

use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.

the class XMLDatatypeUnitTest method testDurationManufacturing.

@Test
@Title("When given an external factory, Podam should be able to create instances of the Duration class")
public void testDurationManufacturing() throws Exception {
    PodamFactory podamFactory = podamFactorySteps.givenAPodamFactoryWithXmlTypesExternalFactory();
    Duration pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(Duration.class, podamFactory);
    podamValidationSteps.theObjectShouldNotBeNull(pojo);
}
Also used : PodamFactory(uk.co.jemos.podam.api.PodamFactory) Duration(javax.xml.datatype.Duration) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

Example 49 with PodamFactory

use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.

the class Pdm43UnitTest method validateDtoInstantiation.

@Test
public void validateDtoInstantiation() {
    PodamFactory podamFactory = new PodamFactoryImpl();
    ConcreteBusinessObject pojo = podamFactory.manufacturePojo(ConcreteBusinessObject.class);
    Assert.assertNotNull("The created POJO cannot be null!", pojo);
}
Also used : PodamFactoryImpl(uk.co.jemos.podam.api.PodamFactoryImpl) ConcreteBusinessObject(uk.co.jemos.podam.test.dto.pdm43.ConcreteBusinessObject) PodamFactory(uk.co.jemos.podam.api.PodamFactory) Test(org.junit.Test)

Example 50 with PodamFactory

use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.

the class WalkThroughExampleUnitTest method testArticleSetup.

@Test
@Title("Podam should fill the Article POJO correctly")
public void testArticleSetup() throws Exception {
    PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
    Article pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(Article.class, podamFactory);
    walkThroughSteps.theArticlePojoShouldBeCorrectlyFilled(pojo);
}
Also used : PodamFactory(uk.co.jemos.podam.api.PodamFactory) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

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