podam icon indicating copy to clipboard operation
podam copied to clipboard

Podam Utils: Problem with filing boolean data.

Open bkraszewski opened this issue 11 years ago • 7 comments

Hi, thank you for your library, its so helpful in unit testing. However, I noticed problem with using boolean fields: I try to generate class using podamFactory.manufacturePojo(Test.class);

i have class:

public class Test{ private boolean visible;

public boolean setVisible(boolean visible){this.visible = visible;} public boolean isVisible(){ return visible;} }

There are also other fields, with other types, but boolean fields causes problem: java.lang.NoSuchMethodException - no getter for field Visible. I see framework is trying to use getVisible - but for booleans i use isFieldName

I could not find similar issue, if it is not valid, please let me know

bkraszewski avatar Dec 15 '14 09:12 bkraszewski

This could be helpful: class Test is generic, and is created using

Test test = podamFactory.manufacturePojo(Test.class, Other.class);

bkraszewski avatar Dec 15 '14 09:12 bkraszewski

Hi Daniil, maybe we can make a change in Podam that for booleans it considers both getXXX and isXXX methods?

Regards,

On 15 Dec 2014, at 09:36, Bartosz Kraszewski [email protected] wrote:

Hi, thank you for your library, its so helpfull in unit testing. Hovewer, I noticed problem with using boolean fields:

i have class:

public class Test{ private boolean visible;

public boolean setVisible(boolean visible){this.visible = visible;} public boolean isVisible(){ return visible;} }

There are also other fields, with other types, but boolean fields causes problem: java.lang.NoSuchMethodException - no getter for field Visible. I see framework is trying to use getVisible - but for booleans i use isFieldName

I could not find similar issue, if it is not valid, please let me know

— Reply to this email directly or view it on GitHub https://github.com/mtedone/podam/issues/68.

mtedone avatar Dec 15 '14 11:12 mtedone

Sure. But I still have issues with access rights to sonatype.org.

daivanov avatar Dec 17 '14 21:12 daivanov

Have you tried the setup mentioned at this page? http://central.sonatype.org/pages/apache-maven.html http://central.sonatype.org/pages/apache-maven.html

Regards, M.

On 17 Dec 2014, at 21:52, Daniil Ivanov [email protected] wrote:

Sure. But I still have issues with access rights to sonatype.org.

— Reply to this email directly or view it on GitHub https://github.com/mtedone/podam/issues/68#issuecomment-67401452.

mtedone avatar Dec 17 '14 23:12 mtedone

So basically there are two observations.

This exception is logged at INFO level and is not a problem per se and cause no effect on the presented POJO population. We should not log exception traces for issues, which are just merely a notification for the user.

But getter discovery is used for fining annotations and were this getter be annotated, PODAm would not find it. I will make a test ensuring now this works as expected.

daivanov avatar Dec 21 '14 10:12 daivanov

Bartosz, could you please verify the issue against latest PODAM release?

daivanov avatar Jan 03 '15 19:01 daivanov

Closing.

daivanov avatar Jan 17 '15 07:01 daivanov