Search in sources :

Example 1 with SimplePojoToTestSetters

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

the class MemoizationTest method whenMemoizationIsFalsePodamShouldReturnDifferentInstancesForDifferentInvocations.

@Test
@Title("When memoization is set to false Podam should return different instances for different invocations")
public void whenMemoizationIsFalsePodamShouldReturnDifferentInstancesForDifferentInvocations() throws Exception {
    PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactory();
    podamFactory.getStrategy().setMemoization(false);
    podamValidationSteps.theMemoizationShouldBeEnabled(podamFactory.getStrategy(), false);
    SimplePojoToTestSetters pojo1 = podamInvocationSteps.whenIInvokeTheFactoryForClass(SimplePojoToTestSetters.class, podamFactory);
    podamValidationSteps.thePojoMustBeOfTheType(pojo1, SimplePojoToTestSetters.class);
    SimplePojoToTestSetters pojo2 = podamInvocationSteps.whenIInvokeTheFactoryForClass(SimplePojoToTestSetters.class, podamFactory);
    podamValidationSteps.thePojoMustBeOfTheType(pojo2, SimplePojoToTestSetters.class);
    podamValidationSteps.theTwoObjectsShouldBeDifferent(pojo1, pojo2);
}
Also used : PodamFactory(uk.co.jemos.podam.api.PodamFactory) SimplePojoToTestSetters(uk.co.jemos.podam.test.dto.SimplePojoToTestSetters) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

Example 2 with SimplePojoToTestSetters

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

the class PodamFactoryInjectionIntegrationTest method testSimplePojo.

@Test
public void testSimplePojo() {
    SimplePojoToTestSetters pojo = factory.manufacturePojo(SimplePojoToTestSetters.class);
    assertThat("The pojo cannot be null!", pojo, not(nullValue()));
    int intField = pojo.getIntField();
    assertThat("The int field cannot be zero!", intField, not(equalTo(0)));
    String stringField = pojo.getStringField();
    assertThat("The string field cannot be null!", stringField, not(nullValue()));
}
Also used : SimplePojoToTestSetters(uk.co.jemos.podam.test.dto.SimplePojoToTestSetters) Test(org.junit.Test)

Example 3 with SimplePojoToTestSetters

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

the class MemoizationTest method whenMemoizationIsTruePodamShouldReturnTheSameInstanceForDifferentInvocations.

@Test
@Title("When memoization is set to true Podam should return the same instance for different invocations")
public void whenMemoizationIsTruePodamShouldReturnTheSameInstanceForDifferentInvocations() throws Exception {
    PodamFactory podamFactory = podamFactorySteps.givenAStandardPodamFactoryWithMemoizationEnabled();
    podamValidationSteps.theMemoizationShouldBeEnabled(podamFactory.getStrategy(), true);
    SimplePojoToTestSetters pojo1 = podamInvocationSteps.whenIInvokeTheFactoryForClass(SimplePojoToTestSetters.class, podamFactory);
    podamValidationSteps.thePojoMustBeOfTheType(pojo1, SimplePojoToTestSetters.class);
    SimplePojoToTestSetters pojo2 = podamInvocationSteps.whenIInvokeTheFactoryForClass(SimplePojoToTestSetters.class, podamFactory);
    podamValidationSteps.thePojoMustBeOfTheType(pojo2, SimplePojoToTestSetters.class);
    podamValidationSteps.theTwoObjectsShouldBeStrictlyEqual(pojo1, pojo2);
}
Also used : PodamFactory(uk.co.jemos.podam.api.PodamFactory) SimplePojoToTestSetters(uk.co.jemos.podam.test.dto.SimplePojoToTestSetters) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

Aggregations

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