Hello,
I am using PODAM for creating Testdata. Unfortunately PODAM does not instatiate enum values or I am missing something.
What I do is:
FACTORY.manufacturePojo(MyType.class);
I will get the wollowing warnings on each Enumaration:
2015-03-26 11:11:47 LoggingExternalFactory [WARN] Cannot instantiate class mypackage.myenum with arguments []. Returning null.
What I did is to Override the PodamFactoryImpl and did it myself:
private static final class MyFactory extends PodamFactoryImpl {
@Override
public <T> T manufacturePojo(final Class<T> pojoClass) {
if (pojoClass.isEnum()) {
return pojoClass.getEnumConstants().length == 0 ? null : pojoClass.getEnumConstants()[new Random().nextInt(pojoClass.getEnumConstants().length)];
}
return super.manufacturePojo(pojoClass);
}
}
It would be also possible to randomly choose one of the existing enums.
I think that could be inserted into the PODAM Project, right?
Best regards,
Andreas