random instantiation of enum values

Skip to first unread message

Andreas Beckers

Mar 26, 2015, 6:17:07 AM3/26/15
to po...@googlegroups.com

I am using PODAM for creating Testdata. Unfortunately PODAM does not instatiate enum values or I am missing something.

What I do is:


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 {

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,

Marco Tedone

Mar 26, 2015, 8:24:19 AM3/26/15
to po...@googlegroups.com
Hi Andreas, the best way of contributing to the project is to fork it and implement a pull request. 

You received this message because you are subscribed to the Google Groups "PODAM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to podam+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Daniil Ivanov

Mar 28, 2015, 7:36:25 AM3/28/15
to po...@googlegroups.com
This was incorporated in podam-5.2.0.
Reply all
Reply to author
0 new messages