I'm trying to figure out how test a small library I'm working on . Using this simplified method as an example:
private int countMappableFields(Class<?> type) {
int mappableFields = 0;
Field[] fields = type.getFields();
for (int i = 0; i < fields.length ; i++) {
if (FieldHelper.isMappable(fields[i]))
mappableFields++;
}
return mappableFields;
}
Should I define a couple of classes in separate files and reference them in all my tests? Is there a different approach that will allow to construct an object for each case?