Search in sources :

Example 1 with ClassAttribute

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

the class ClassInfoTest method podamShouldReturnAValidClassInfoForPojoWithNoAttributes.

@Test
@Title("Podam should return valid class info for POJOs with no attributes")
public void podamShouldReturnAValidClassInfoForPojoWithNoAttributes() {
    List<ClassAttribute> attributes = new ArrayList<ClassAttribute>();
    ClassInfo expectedClassInfo = podamFactorySteps.givenAClassInfoForPojoWithNoAttributes(EmptyTestPojo.class, attributes);
    ClassAttributeApprover nullApprover = null;
    ClassInfo actualClassInfo = podamInvocationSteps.getClassInfo(EmptyTestPojo.class, nullApprover);
    podamValidationSteps.theTwoObjectsShouldBeEqual(expectedClassInfo, actualClassInfo);
}
Also used : ClassAttribute(uk.co.jemos.podam.api.ClassAttribute) ArrayList(java.util.ArrayList) ClassAttributeApprover(uk.co.jemos.podam.api.ClassAttributeApprover) ClassInfo(uk.co.jemos.podam.api.ClassInfo) Test(org.junit.Test) Title(net.thucydides.core.annotations.Title)

Example 2 with ClassAttribute

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

the class ClassInfoValidationSteps method theClassInfoAttributesShouldMatchthePojoOnes.

@Step("Then the attributes contains in ClassInfo should match the ones contains in the POJO")
public void theClassInfoAttributesShouldMatchthePojoOnes(Set<String> attribs, Set<ClassAttribute> classAttributes) {
    Set<String> missingAttribs = new HashSet<String>(attribs);
    for (ClassAttribute attribute : classAttributes) {
        String attrName = attribute.getName();
        assertThat("Unexpected attribute", attrName, isIn(missingAttribs));
        missingAttribs.remove(attrName);
        Assert.assertEquals("Wrong number of getters for " + attribute.getName(), 1, attribute.getGetters().size());
        Assert.assertEquals("Wrong number of setters for " + attribute.getName(), 1, attribute.getSetters().size());
    }
    assertThat("Missing attributes", missingAttribs, is(empty()));
}
Also used : ClassAttribute(uk.co.jemos.podam.api.ClassAttribute) HashSet(java.util.HashSet) Step(net.thucydides.core.annotations.Step)

Aggregations

ClassAttribute (uk.co.jemos.podam.api.ClassAttribute)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Step (net.thucydides.core.annotations.Step)1 Title (net.thucydides.core.annotations.Title)1 Test (org.junit.Test)1 ClassAttributeApprover (uk.co.jemos.podam.api.ClassAttributeApprover)1 ClassInfo (uk.co.jemos.podam.api.ClassInfo)1