Search in sources :

Example 1 with DataProviderStrategy

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

the class PodamFactoryBasicTypesTest method podamShouldSupportCircularDependenciesCustomDepth.

@Test
@Title("Podam should fill in POJOs which have a circular dependency and custom depth")
public void podamShouldSupportCircularDependenciesCustomDepth() throws Exception {
    DataProviderStrategy strategy = podamFactorySteps.givenACustomDataProviderStrategy();
    PodamFactory podamFactory = podamFactorySteps.givenAPodamFactoryWithCustomDataProviderStrategy(strategy);
    createPojoWithCircularDependencies(podamFactory);
}
Also used : DataProviderStrategy(uk.co.jemos.podam.api.DataProviderStrategy) PodamFactory(uk.co.jemos.podam.api.PodamFactory) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

Example 2 with DataProviderStrategy

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

the class RandomDataProviderStrategyImplInitialisationUnitTest method podamShouldCorrectGenerateHashMapsWithLongAsKeyType.

@Test
@Title("Podam should correctly generate HashMaps with Long as key type")
public void podamShouldCorrectGenerateHashMapsWithLongAsKeyType() throws Exception {
    DataProviderStrategy strategy = podamFactorySteps.givenACustomRandomDataProviderStrategy();
    PodamFactory podamFactory = podamFactorySteps.givenAPodamFactoryWithCustomDataProviderStrategy(strategy);
    Map<?, ?> pojo = podamInvocationSteps.whenIInvokeTheFactoryForGenericTypeWithSpecificType(HashMap.class, podamFactory, Long.class, String.class);
    podamValidationSteps.theObjectShouldNotBeNull(pojo);
    podamValidationSteps.theTwoObjectsShouldBeEqual(strategy.getNumberOfCollectionElements(String.class), pojo.size());
}
Also used : DataProviderStrategy(uk.co.jemos.podam.api.DataProviderStrategy) AbstractRandomDataProviderStrategy(uk.co.jemos.podam.api.AbstractRandomDataProviderStrategy) PodamFactory(uk.co.jemos.podam.api.PodamFactory) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

Example 3 with DataProviderStrategy

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

the class MultipleInterfacesInheritanceTest method provideCustomisedPodamFactory.

// -------------> Private methods
private PodamFactory provideCustomisedPodamFactory() throws Exception {
    TrackingExternalFactory externalFactory = podamFactorySteps.givenATrackingExternalFactory();
    DataProviderStrategy customDataProviderStrategy = podamFactorySteps.givenACustomDataProviderStrategy();
    PodamFactory podamFactory = podamFactorySteps.givenAPodamFactoryWithExternalFactoryAndCustomStrategy(externalFactory, customDataProviderStrategy);
    return podamFactory;
}
Also used : DataProviderStrategy(uk.co.jemos.podam.api.DataProviderStrategy) PodamFactory(uk.co.jemos.podam.api.PodamFactory)

Example 4 with DataProviderStrategy

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

the class PodamStrategySteps method removeSpecific.

@Step("When I remove a specific type {1} for an abstract type or interface")
public <T> void removeSpecific(PodamFactory podamFactory, Class<T> abstractType) {
    DataProviderStrategy strategy = podamFactory.getStrategy();
    strategy.removeSpecific(abstractType);
}
Also used : DataProviderStrategy(uk.co.jemos.podam.api.DataProviderStrategy) Step(net.thucydides.core.annotations.Step)

Example 5 with DataProviderStrategy

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

the class PodamFactoryBasicTypesTest method podamShouldFillRecursivePojosWithLists.

@Test
@Title("Podam should fill recursive POJOs correctly, including all their list fields")
public void podamShouldFillRecursivePojosWithLists() throws Exception {
    DataProviderStrategy strategy = podamFactorySteps.givenACustomDepthDataProviderStrategy();
    PodamFactory podamFactory = podamFactorySteps.givenAPodamFactoryWithCustomDataProviderStrategy(strategy);
    RecursivePojoWithList recursivePojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(RecursivePojoWithList.class, podamFactory);
    podamValidationSteps.thePojoMustBeOfTheType(recursivePojo, RecursivePojoWithList.class);
    podamValidationSteps.thePojoMustBeOfTheType(recursivePojo.getRelated(), RecursivePojoWithList.class);
    podamValidationSteps.theCollectionShouldNotBeNullOrEmptyAndContainElementsOfType(recursivePojo.getChildren(), RecursivePojoWithList.class);
    for (RecursivePojoWithList child : recursivePojo.getChildren()) {
        podamValidationSteps.thePojoShouldBeNull(child.getRelated());
        podamValidationSteps.theCollectionShouldBeEmpty(child.getChildren());
    }
}
Also used : DataProviderStrategy(uk.co.jemos.podam.api.DataProviderStrategy) PodamFactory(uk.co.jemos.podam.api.PodamFactory) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

Aggregations

DataProviderStrategy (uk.co.jemos.podam.api.DataProviderStrategy)10 Title (net.thucydides.core.annotations.Title)6 Test (org.junit.Test)6 PodamFactory (uk.co.jemos.podam.api.PodamFactory)5 AbstractRandomDataProviderStrategy (uk.co.jemos.podam.api.AbstractRandomDataProviderStrategy)3 Type (java.lang.reflect.Type)2 HashMap (java.util.HashMap)2 Step (net.thucydides.core.annotations.Step)2 AttributeMetadata (uk.co.jemos.podam.api.AttributeMetadata)2 PojoWithMapsAndCollections (uk.co.jemos.podam.test.dto.PojoWithMapsAndCollections)1 ExternalRatePodamEnum (uk.co.jemos.podam.test.enums.ExternalRatePodamEnum)1