Search in sources :

Example 86 with PodamFactory

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

the class ConstructorsUnitTest method podamShouldBeAbleToManufacturePojosWhichContainImmutableCollections.

@Test
@Title("Podam should be able to manufacture POJOs which contain immutable collections")
public void podamShouldBeAbleToManufacturePojosWhichContainImmutableCollections() throws Exception {
    PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
    ImmutableDefaultFieldsPojo model = podamInvocationSteps.whenIInvokeTheFactoryForClass(ImmutableDefaultFieldsPojo.class, podamFactory);
    podamValidationSteps.thePojoMustBeOfTheType(model, ImmutableDefaultFieldsPojo.class);
    podamValidationSteps.theCollectionShouldNotBeNullOrEmptyAndShouldHaveExactlyTheExpectedNumberOfElements(model.getList(), String.class, podamFactory.getStrategy().getNumberOfCollectionElements(model.getList().getClass()));
    podamValidationSteps.theMapShouldNotBeNullOrEmptyAndShouldHaveExactlyTheExpectedNumberOfElements(model.getMap(), String.class, Integer.class, podamFactory.getStrategy().getNumberOfCollectionElements(model.getMap().getClass()));
}
Also used : PodamFactory(uk.co.jemos.podam.api.PodamFactory) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

Example 87 with PodamFactory

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

the class ConstructorsUnitTest method podamShouldHandleGenericsInStaticConstructorsDuringPojoInstantiation.

@Test
@Title("Podam should handle generics in static constructors during POJO instantiation")
public void podamShouldHandleGenericsInStaticConstructorsDuringPojoInstantiation() throws Exception {
    PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
    GenericInStaticConstructorPojo pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(GenericInStaticConstructorPojo.class, podamFactory);
    podamValidationSteps.thePojoMustBeOfTheType(pojo, GenericInStaticConstructorPojo.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 88 with PodamFactory

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

the class ClassUnitTest method podamShouldHandleTheManufacturingOfGenericPojos.

@Test
@Title("Podam should handle the manufacturing of generic POJOs")
public void podamShouldHandleTheManufacturingOfGenericPojos() throws Exception {
    PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
    ClassGenericPojo<?> pojo = podamInvocationSteps.whenIInvokeTheFactoryForGenericTypeWithSpecificType(ClassGenericPojo.class, podamFactory, String.class);
    podamValidationSteps.thePojoMustBeOfTheType(pojo, ClassGenericPojo.class);
    podamValidationSteps.thePojoMustBeOfTheType(pojo.getClazz(), Class.class);
    podamValidationSteps.theTwoObjectsShouldBeEqual(String.class, pojo.getClazz());
}
Also used : PodamFactory(uk.co.jemos.podam.api.PodamFactory) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

Example 89 with PodamFactory

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

the class ClassUnitTest method podamShouldHandleTheManufacturingOfPojosWithGenericTypesInTheConstructor.

@Test
@Title("Podam should handle the manufacturing of POJOs with generic types in constructor")
public void podamShouldHandleTheManufacturingOfPojosWithGenericTypesInTheConstructor() throws Exception {
    PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
    ClassGenericConstructorPojo<?> pojo = podamInvocationSteps.whenIInvokeTheFactoryForGenericTypeWithSpecificType(ClassGenericConstructorPojo.class, podamFactory, String.class);
    podamValidationSteps.thePojoMustBeOfTheType(pojo, ClassGenericConstructorPojo.class);
    podamValidationSteps.thePojoMustBeOfTheType(pojo.getClazz(), Class.class);
    podamValidationSteps.theTwoObjectsShouldBeEqual(String.class, pojo.getClazz());
}
Also used : PodamFactory(uk.co.jemos.podam.api.PodamFactory) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

Example 90 with PodamFactory

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

the class PodamFactoryBasicTypesTest method podamShouldFillPojoWithEnums.

@Test
@Title("Podam should fill in POJOs with Enums")
public void podamShouldFillPojoWithEnums() throws Exception {
    PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
    EnumsPojo pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(EnumsPojo.class, podamFactory);
    podamValidationSteps.thePojoMustBeOfTheType(pojo, EnumsPojo.class);
    ExternalRatePodamEnum ratePodamExternal = pojo.getRatePodamExternal();
    podamValidationSteps.thePojoMustBeOfTheType(ratePodamExternal, ExternalRatePodamEnum.class);
    EnumsPojo.RatePodamInternal ratePodamInternal = pojo.getRatePodamInternal();
    podamValidationSteps.thePojoMustBeOfTheType(ratePodamInternal, EnumsPojo.RatePodamInternal.class);
    EnumsPojo.EmptyPodamInternal emptyPodamInternal = pojo.getEmptyPodamInternal();
    podamValidationSteps.thePojoShouldBeNull(emptyPodamInternal);
}
Also used : PodamFactory(uk.co.jemos.podam.api.PodamFactory) ExternalRatePodamEnum(uk.co.jemos.podam.test.enums.ExternalRatePodamEnum) 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