Search in sources :

Example 36 with PodamFactory

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

the class ConstructorsUnitTest method podamShouldCreateInstancesOfJAXBElementsDeclaredAsInstanceVariablesInAPojo.

@Test
@Title("Podam should be able to create instances of JAXBElements declared as instance variables in a POJO")
public void podamShouldCreateInstancesOfJAXBElementsDeclaredAsInstanceVariablesInAPojo() throws Exception {
    PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
    JAXBElementPojo<?> pojo = podamInvocationSteps.whenIInvokeTheFactoryForGenericTypeWithSpecificType(JAXBElementPojo.class, podamFactory, String.class);
    podamValidationSteps.thePojoMustBeOfTheType(pojo, JAXBElementPojo.class);
    podamValidationSteps.thePojoMustBeOfTheType(pojo.getValue(), JAXBElement.class);
    podamValidationSteps.thePojoMustBeOfTheType(pojo.getValue().getName(), QName.class);
    podamValidationSteps.thePojoMustBeOfTheType(pojo.getValue().getValue(), String.class);
}
Also used : PodamFactory(uk.co.jemos.podam.api.PodamFactory) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

Example 37 with PodamFactory

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

the class ReadOnlyComplexTypesTest method podamShouldFillReadOnlyTypes.

@Test
@Title("Podam should fill in read-only POJOs")
public void podamShouldFillReadOnlyTypes() throws Exception {
    PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
    ReadOnlyComplexTypesPojo pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(ReadOnlyComplexTypesPojo.class, podamFactory);
    podamValidationSteps.thePojoMustBeOfTheType(pojo, ReadOnlyComplexTypesPojo.class);
    podamValidationSteps.theArrayOfTheGivenTypeShouldNotBeNullOrEmptyAndContainElementsOfTheRightType(pojo.getArray(), String.class);
    podamValidationSteps.theCollectionShouldNotBeNullOrEmptyAndContainElementsOfType(pojo.getList(), Integer.class);
    podamValidationSteps.theMapShouldNotBeNullOrEmptyAndContainElementsOfType(pojo.getMap(), Long.class, String.class);
    podamValidationSteps.thePojoMustBeOfTheType(pojo.getValue(), ReadOnlyComplexTypesPojo.Value.class);
    podamValidationSteps.thePojoMustBeOfTheType(pojo.getValue().getValue(), String.class);
}
Also used : PodamFactory(uk.co.jemos.podam.api.PodamFactory) ReadOnlyComplexTypesPojo(uk.co.jemos.podam.test.dto.ReadOnlyComplexTypesPojo) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

Example 38 with PodamFactory

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

the class ReadOnlyComplexTypesTest method podamShouldFillInPojosWhichContainInternalLoops.

@Test
@Title("Podam should fill in POJOs which contain internal loops (e.g. objects that reference parents)")
public void podamShouldFillInPojosWhichContainInternalLoops() throws Exception {
    PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
    BeanContextServicesSupport pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(BeanContextServicesSupport.class, podamFactory);
    podamValidationSteps.thePojoMustBeOfTheType(pojo, BeanContextServicesSupport.class);
}
Also used : PodamFactory(uk.co.jemos.podam.api.PodamFactory) BeanContextServicesSupport(java.beans.beancontext.BeanContextServicesSupport) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

Example 39 with PodamFactory

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

the class ConstructorsUnitTest method podamShouldHandleGenericsInSettersDuringPojoInstantiation.

@Test
@Title("Podam should handle generics in setters during Pojo instantiation")
public void podamShouldHandleGenericsInSettersDuringPojoInstantiation() throws Exception {
    PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
    GenericInSetterPojo pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(GenericInSetterPojo.class, podamFactory);
    podamValidationSteps.thePojoMustBeOfTheType(pojo, GenericInSetterPojo.class);
    podamValidationSteps.theCollectionShouldNotBeNullOrEmptyAndContainElementsOfType(pojo.getVector(), String.class);
}
Also used : PodamFactory(uk.co.jemos.podam.api.PodamFactory) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

Example 40 with PodamFactory

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

the class ConstructorsUnitTest method podamShouldHandleConstructorsWithGenericArraysDuringPojoInstantiation.

@Test
@Title("Podam should handle constructors with generic arrays during Pojo instantiation")
public void podamShouldHandleConstructorsWithGenericArraysDuringPojoInstantiation() {
    PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
    GenericArrayInConstructorPojo<?> pojo = podamInvocationSteps.whenIInvokeTheFactoryForGenericTypeWithSpecificType(GenericArrayInConstructorPojo.class, podamFactory, String.class);
    podamValidationSteps.thePojoMustBeOfTheType(pojo, GenericArrayInConstructorPojo.class);
    podamValidationSteps.theArrayOfTheGivenTypeShouldNotBeNullOrEmptyAndContainElementsOfTheRightType(pojo.getArray(), String.class);
}
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