Search in sources :

Example 81 with PodamFactory

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

the class ConstructorsUnitTest method podamShouldCreateInstancesOfGenericReadOnlyPojosWithFactoryMethodsWhenTheConcreteTypeIsKnown.

@Test
@Title("Podam should be able to create instances of generic read only POJOs with factory methods when the concrete type is known")
public void podamShouldCreateInstancesOfGenericReadOnlyPojosWithFactoryMethodsWhenTheConcreteTypeIsKnown() throws Exception {
    PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
    FactoryInstantiableReadOnlyPojo<?> pojo = podamInvocationSteps.whenIInvokeTheFactoryForGenericTypeWithSpecificType(FactoryInstantiableReadOnlyPojo.class, podamFactory, String.class);
    podamValidationSteps.thePojoMustBeOfTheType(pojo, FactoryInstantiableReadOnlyPojo.class);
    podamValidationSteps.thePojoMustBeOfTheType(pojo.getTypedValue(), String.class);
}
Also used : PodamFactory(uk.co.jemos.podam.api.PodamFactory) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

Example 82 with PodamFactory

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

the class ConstructorsUnitTest method podamShouldBeAbleToManufactureAnyTypeOfMaps.

@Test
@Title("Podam should be able to manufacture any type of Maps")
public void podamShouldBeAbleToManufactureAnyTypeOfMaps() throws Exception {
    PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
    UnsupportedMapInConstructorPojo<?, ?> pojo = podamInvocationSteps.whenIInvokeTheFactoryForGenericTypeWithSpecificType(UnsupportedMapInConstructorPojo.class, podamFactory, String.class, Integer.class);
    podamValidationSteps.thePojoMustBeOfTheType(pojo, UnsupportedMapInConstructorPojo.class);
    podamValidationSteps.theMapShouldNotBeNullOrEmptyAndContainElementsOfType(pojo.getHashTable(), String.class, Integer.class);
}
Also used : PodamFactory(uk.co.jemos.podam.api.PodamFactory) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

Example 83 with PodamFactory

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

the class ConstructorsUnitTest method podamShouldHandleGenericCollectionsInConstructorWithMemoizationDisabled.

@Test
@Title("Podam should correctly handle generic collections in constructor with memoization disabled")
public void podamShouldHandleGenericCollectionsInConstructorWithMemoizationDisabled() throws Exception {
    PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
    GenericCollectionsConstructorPojo pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(GenericCollectionsConstructorPojo.class, podamFactory);
    podamValidationSteps.thePojoMustBeOfTheType(pojo, GenericCollectionsConstructorPojo.class);
    podamValidationSteps.theCollectionShouldNotBeNullOrEmptyAndContainElementsOfType(pojo.getList1(), Long.class);
    podamValidationSteps.theCollectionShouldNotBeNullOrEmptyAndContainElementsOfType(pojo.getList2(), String.class);
    podamValidationSteps.theCollectionShouldNotBeNullOrEmptyAndContainElementsOfType(pojo.getList3(), Integer.class);
}
Also used : GenericCollectionsConstructorPojo(uk.co.jemos.podam.test.dto.issue123.GenericCollectionsConstructorPojo) PodamFactory(uk.co.jemos.podam.api.PodamFactory) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

Example 84 with PodamFactory

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

the class ConstructorsUnitTest method podamShouldBeAbleToManufactureAnyTypeOfCollections.

@Test
@Title("Podam should be able to manufacture any type of Lists")
public void podamShouldBeAbleToManufactureAnyTypeOfCollections() throws Exception {
    PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
    UnsupportedCollectionInConstructorPojo<?> pojo = podamInvocationSteps.whenIInvokeTheFactoryForGenericTypeWithSpecificType(UnsupportedCollectionInConstructorPojo.class, podamFactory, String.class);
    podamValidationSteps.thePojoMustBeOfTheType(pojo, UnsupportedCollectionInConstructorPojo.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 85 with PodamFactory

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

the class ConstructorsUnitTest method podamShouldCreateInstancesOfJAXBElements.

@Test
@Title("Podam should be able to create instances of JAXBElement")
public void podamShouldCreateInstancesOfJAXBElements() throws Exception {
    PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
    JAXBElement<?> pojo = podamInvocationSteps.whenIInvokeTheFactoryForGenericTypeWithSpecificType(JAXBElement.class, podamFactory, String.class);
    podamValidationSteps.thePojoMustBeOfTheType(pojo, JAXBElement.class);
    podamValidationSteps.thePojoMustBeOfTheType(pojo.getName(), QName.class);
    podamValidationSteps.thePojoMustBeOfTheType(pojo.getValue(), 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