use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class RandomDataProviderStrategyImplInitialisationUnitTest method podamShouldCreatePojosInAccordanceWithCustomDataProviderStrategies.
@Test
@Title("Podam should create POJOs in accordance with custom data provider strategies")
public void podamShouldCreatePojosInAccordanceWithCustomDataProviderStrategies() throws Exception {
DataProviderStrategy strategy = podamFactorySteps.givenACustomRandomDataProviderStrategy();
PodamFactory podamFactory = podamFactorySteps.givenAPodamFactoryWithCustomDataProviderStrategy(strategy);
PojoWithMapsAndCollections pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(PojoWithMapsAndCollections.class, podamFactory);
podamValidationSteps.theObjectShouldNotBeNull(pojo);
podamValidationSteps.theArrayOfTheGivenTypeShouldNotBeNullOrEmptyAndContainExactlyTheGivenNumberOfElements(pojo.getArray(), 2, String.class);
podamValidationSteps.theCollectionShouldNotBeNullOrEmptyAndShouldHaveExactlyTheExpectedNumberOfElements(pojo.getList(), Boolean.class, 3);
podamValidationSteps.theMapShouldNotBeNullOrEmptyAndShouldHaveExactlyTheExpectedNumberOfElements(pojo.getMap(), Integer.class, Long.class, 4);
}
use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class AbnormalPojosTest method podamCannotHandleCircularConstructors.
@Test
@Title("Invoking Podam on a POJO with a circular constructor (e.g. java.net.URL) leads to a null POJO")
public void podamCannotHandleCircularConstructors() throws Exception {
PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
URL pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(URL.class, podamFactory);
podamValidationSteps.thePojoShouldBeNull(pojo);
}
use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class ExtensionsTest method podamShouldCreateInputStreamWithCustomTypeManufacturer.
@Test
@Title("Podam should create InputStream with the custom type manufacturer")
public void podamShouldCreateInputStreamWithCustomTypeManufacturer() throws Exception {
PodamFactory podamFactory = podamFactorySteps.givenAPodamWithAInputStreamTypeManufacturer();
InputStream inputStream = podamInvocationSteps.whenIInvokeTheFactoryForClass(InputStream.class, podamFactory);
podamValidationSteps.thePojoMustBeOfTheType(inputStream, InputStream.class);
podamInvocationSteps.whenIRemoveTypeManufacturer(podamFactory, InputStream.class);
InputStream inputStream2 = podamInvocationSteps.whenIInvokeTheFactoryForClass(InputStream.class, podamFactory);
podamValidationSteps.theObjectShouldBeNull(inputStream2);
}
use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class ExtensionsTest method podamShouldFillTheAttributeMetadataWithTheAttributeNames.
@Test
@Title("Podam should fill AttributeMetadata with the attribute name")
public void podamShouldFillTheAttributeMetadataWithTheAttributeNames() throws Exception {
PodamFactory podamFactory = podamFactorySteps.givenAPodamWithACustomStringTypeManufacturer();
PojoClassic pojoClassic = podamInvocationSteps.whenIInvokeTheFactoryForClass(PojoClassic.class, podamFactory);
podamValidationSteps.theObjectShouldNotBeNull(pojoClassic);
PojoSpecific pojoSpecific = podamInvocationSteps.whenIInvokeTheFactoryForClass(PojoSpecific.class, podamFactory);
podamValidationSteps.theObjectShouldNotBeNull(pojoSpecific);
podamValidationSteps.theStringValueShouldBeExactly(pojoClassic.getAtt(), "classic");
podamValidationSteps.theStringValueShouldBeExactly(pojoSpecific.getAtt(), "specific");
}
use of uk.co.jemos.podam.api.PodamFactory in project podam by devopsfolks.
the class ExtensionsTest method podamShouldCreateTimestampWithCustomTypeManufacturer.
@Test
@Title("Podam should create Timestamp with the custom type manufacturer")
public void podamShouldCreateTimestampWithCustomTypeManufacturer() throws Exception {
PodamFactory podamFactory = podamFactorySteps.givenAPodamWithACustomIntegerTypeManufacturer();
Timestamp timestamp = podamInvocationSteps.whenIInvokeTheFactoryForClass(Timestamp.class, podamFactory);
podamValidationSteps.theObjectShouldNotBeNull(timestamp);
}
Aggregations