mtedone / podam

PODAM - POjo DAta Mocker
https://mtedone.github.io/podam
MIT License
323 stars 750 forks source link

Manufacturing of nested generic type properties #225

Closed opeled closed 7 years ago

opeled commented 7 years ago

I have the following object hierarchy:

public class A { private B<String> b; }

public class B<T> { private List<C<T>> values;

public class C<T> { private T value; }

Trying to manufacture an A object with data using: new PodamFactoryImpl().manufacturePojo(A.class)

throws the following exception: java.lang.IllegalStateException: com.C is missing generic type arguments, expected [T] found [T]

needless to say this works: new PodamFactoryImpl().manufacturePojoWithFullData(C.class, String.class)

opeled commented 7 years ago

This is not exactly the same, as in the test reference, the GenericListPojo class is generic. In my example the A class is not generic, however it contains a generic proeprty.

Accidentally closed the issue.

daivanov commented 7 years ago

Your class B is also generic. And the error is the same, but I guess you are using some older version of Podam:

uk.co.jemos.podam.exceptions.PodamMockeryException: An exception occurred while resolving the collection at uk.co.jemos.podam.test.unit.pdm45.Pdm45UnitTest.testGenericListPojoManufacture(Pdm45UnitTest.java:45) Caused by: java.lang.IllegalArgumentException: uk.co.jemos.podam.test.dto.pdm45.GenericPojo is missing generic type arguments, expected [F, S], provided [F, S] at uk.co.jemos.podam.test.unit.pdm45.Pdm45UnitTest.testGenericListPojoManufacture(Pdm45UnitTest.java:45)

daivanov commented 7 years ago

Please, give it a try with Podam 7.0.4-SNAPSHOT.

opeled commented 7 years ago

Issue solved. Can you please release and upload to mvn repository ?

daivanov commented 7 years ago

Now it should appear at some point in Maven. Thank you for reporting this issue.