Podam - generating precise data for some types with random data for the rest

29 views
Skip to first unread message

Robin Roos

unread,
Mar 13, 2020, 12:24:09 PM3/13/20
to PODAM

We are using PODAM to generate randomised POJOs for test purposes. My testing has a requirement that some types (RefData below) are filled with specific data.

For example, 

class RefData {
    String code;
    String description;
}

class Person {
    String name;
    RefData maritalStatus;
}

When manufacturing a Person instance, I am happy for name to be random, but I want to have control to create and populate any instances of RefData type myself, so that I can constrain them to valid values.

I have played around extensively with TypeManufacturer (seems to instantiate the type and populate it, but PODAM then applies random data over the top). I have also tried with AbstractExternalFactory, without success (perhaps it cannot apply to concrete types, only abstract and interface types).

Any suggestions would be welcomed, Robin.

Robin Roos

unread,
Mar 13, 2020, 5:30:21 PM3/13/20
to PODAM
I have resolved this. I will distil the approach and post it here in a few days’ time.
Reply all
Reply to author
Forward
0 new messages