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);
}
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()));
}
Aggregations