podam icon indicating copy to clipboard operation
podam copied to clipboard

Manufacturing of nested generic type properties

Open opeled opened this issue 9 years ago • 5 comments

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 avatar Dec 20 '16 09:12 opeled

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.

opeled avatar Dec 20 '16 12:12 opeled

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 avatar Dec 20 '16 12:12 daivanov

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

daivanov avatar Dec 21 '16 01:12 daivanov

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

opeled avatar Dec 22 '16 06:12 opeled

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

daivanov avatar Dec 22 '16 23:12 daivanov