Search in sources :

Example 6 with DataProviderStrategy

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

the class PodamStrategySteps method addOrReplaceSpecific.

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

Example 7 with DataProviderStrategy

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

the class TypeManufacturingTest method produceValueForType.

private Object produceValueForType(Class<?> attributeType) {
    DataProviderStrategy dataProviderStrategy = podamFactorySteps.givenARandomDataProviderStrategy();
    Object pojoInstance = null;
    AttributeMetadata attributeMetadata = podamFactorySteps.givenAnAttributeMetadata(SimplePojoToTestSetters.class, pojoInstance, attributeType);
    podamValidationSteps.theObjectShouldNotBeNull(attributeMetadata);
    Map<String, Type> genericTypeArgumentsMap = new HashMap<String, Type>();
    return podamInvocationSteps.whenISendAMessageToTheChannel(dataProviderStrategy, attributeMetadata, genericTypeArgumentsMap, attributeType);
}
Also used : Type(java.lang.reflect.Type) DataProviderStrategy(uk.co.jemos.podam.api.DataProviderStrategy) HashMap(java.util.HashMap) AttributeMetadata(uk.co.jemos.podam.api.AttributeMetadata)

Example 8 with DataProviderStrategy

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

the class TypeManufacturingTest method podamMessagingSystemShouldReturnAnEnumValue.

@Test
@Title("Podam Messaging System should return an Enum value")
public void podamMessagingSystemShouldReturnAnEnumValue() throws Exception {
    DataProviderStrategy dataProviderStrategy = podamFactorySteps.givenARandomDataProviderStrategy();
    Object pojoInstance = null;
    AttributeMetadata attributeMetadata = podamFactorySteps.givenAnAttributeMetadataForEnums(ExternalRatePodamEnum.class, pojoInstance);
    podamValidationSteps.theObjectShouldNotBeNull(attributeMetadata);
    Map<String, Type> genericTypeArgumentsMap = new HashMap<String, Type>();
    Object payload = podamInvocationSteps.whenISendAMessageToTheChannel(dataProviderStrategy, attributeMetadata, genericTypeArgumentsMap, ExternalRatePodamEnum.class.getSuperclass());
    podamValidationSteps.theObjectShouldNotBeNull(payload);
}
Also used : Type(java.lang.reflect.Type) DataProviderStrategy(uk.co.jemos.podam.api.DataProviderStrategy) HashMap(java.util.HashMap) AttributeMetadata(uk.co.jemos.podam.api.AttributeMetadata) ExternalRatePodamEnum(uk.co.jemos.podam.test.enums.ExternalRatePodamEnum) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

Aggregations

DataProviderStrategy (uk.co.jemos.podam.api.DataProviderStrategy)8 Title (net.thucydides.core.annotations.Title)4 Test (org.junit.Test)4 AbstractRandomDataProviderStrategy (uk.co.jemos.podam.api.AbstractRandomDataProviderStrategy)3 PodamFactory (uk.co.jemos.podam.api.PodamFactory)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