Should the PODAM have been a bit more lenient with its definition of POJO?

Skip to first unread message

Sunil Veeramuthu

Apr 10, 2015, 5:09:31 PM4/10/15
Firstly, great library! I've been using it for a while now and it helps greatly with what I use it for.

On topic, I often deal with classes that are not the purest POJOs one would have seen, but very much require mock objects to be generated like a pure POJO would have. For instance, consider this class:

public class SpecialPojo {
  private static class Holder {
    private String holdingString;
    private long holdingLong;
  private Holder myHolder;
  public SpecialPojo() {
    myHolder = new Holder();
  public String getMyString() {
    return myHolder.holdingString;
  public void setMyString(String myString) {
    myHolder.holdingString = myString;
  public long getMyLong() {
    return myHolder.holdingLong;
  public void setMyLong(long myLong) {
    myHolder.holdingLong = myLong;

There's no reason to not call it a POJO, but PODAM won't map it b/c it's not got explicit state variables defined to match the setters/getters. If only PODAM didn't care about the instance variables and just tried to call the setters with the value to set, I'd have had an easier time mocking this class and generating an object with arbitrary values. Here's that part of PODAM (particularly the items in bold) I'm talking about:

    public static ClassInfo getClassInfo(Class<?> clazz, Set<Class<? extends Annotation>> excludeFieldAnnotations) {
        Set<String> classFields = getDeclaredInstanceFields(clazz, excludeFieldAnnotations);
        Set<Method> classSetters = getPojoSetters(clazz, classFields);
        return new ClassInfo(clazz, classFields, classSetters);

Is this something the PODAM team can look into? Don't you think it'd add value to relax PODAM's definition of POJO a bit to accommodate such special cases?

Marco Tedone

Apr 10, 2015, 6:59:31 PM4/10/15
Hi Sunil, 

Thank you for using Podam. Our mantra is to serve the open-source community and your feedback means a lot to us. Yours is a good suggestion, so please raise an issue in GitHub and Daniil and I will discuss it for implementation.


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
For more options, visit

Sunil Veeramuthu

Apr 10, 2015, 8:02:06 PM4/10/15
Appreciate the quick response, Marco!

Here's this logged as an issue in github with the same example:
Reply all
Reply to author
0 new messages