Search in sources :

Example 1 with RecursivePojo

use of uk.co.jemos.podam.test.dto.RecursivePojo in project podam by devopsfolks.

the class MemoizationTest method memoizationShouldWorkForRecursivePojos.

@Test
@Title("Memoization should work for recursive Pojos")
public void memoizationShouldWorkForRecursivePojos() throws Exception {
    PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactoryWithMemoizationEnabled();
    podamValidationSteps.theMemoizationShouldBeEnabled(podamFactory.getStrategy(), true);
    RecursivePojo pojo = podamInvocationSteps.whenIInvokeTheFactoryForClass(RecursivePojo.class, podamFactory);
    podamValidationSteps.thePojoMustBeOfTheType(pojo, RecursivePojo.class);
    podamValidationSteps.theTwoObjectsShouldBeStrictlyEqual(pojo, pojo.getParent());
}
Also used : PodamFactory(uk.co.jemos.podam.api.PodamFactory) RecursivePojo(uk.co.jemos.podam.test.dto.RecursivePojo) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

Example 2 with RecursivePojo

use of uk.co.jemos.podam.test.dto.RecursivePojo in project podam by devopsfolks.

the class RecursivePojoValidationSteps method allPojosInTheRecursiveStrategyShouldBeValid.

@Step("Then all the POJOs in the recursive hierarchy should be valid")
public void allPojosInTheRecursiveStrategyShouldBeValid(RecursivePojo pojo) {
    assertThat("The integer value in the pojo should not be zero!", pojo.getIntField(), not(equalTo(0)));
    RecursivePojo parentPojo = pojo.getParent();
    assertThat("The parent pojo cannot be null!", parentPojo, not(nullValue()));
    assertThat("The integer value in the parent pojo should not be zero!", parentPojo.getIntField(), not(equalTo(0)));
    assertThat("The parent attribute of the parent pojo cannot be null!", parentPojo.getParent(), not(nullValue()));
}
Also used : RecursivePojo(uk.co.jemos.podam.test.dto.RecursivePojo) Step(net.thucydides.core.annotations.Step)

Aggregations

RecursivePojo (uk.co.jemos.podam.test.dto.RecursivePojo)2 Step (net.thucydides.core.annotations.Step)1 Title (net.thucydides.core.annotations.Title)1 Test (org.junit.Test)1 PodamFactory (uk.co.jemos.podam.api.PodamFactory)1