Closed tomasbjerre closed 8 years ago
Try looking at http://mtedone.github.io/podam/annotations.html
And at the AnnotationTest class, test named: podamShouldAssignExactValuesDefinedInPodamStrategyValueAnnotation
However you'll need to test if this works without getters and setters on your property. With setters and getters it will definitely work but then you wouldn't need a custom annotation, unless you wanted to create a specific NotificationDTO.
As for caching values, this is driven by the memoization. Memoization is enabled by default. This means that if an object is created Podam won't recreate it. More can be found here (look at "Tweaking Podam for performance"):
http://mtedone.github.io/podam/
Hope this helps
Should I interpret the answer as no? I cannot see any annotation there that does exactly what factory.manufacturePojo(NotificationDTO.class)
does. I think it would be nice to have an annotation that does that so that I can use in on an attribute in a unit test case.
Like here. I'd like to move that variable to an attribute and annotate it instead of making that static call.
I really dont like the idea of adding Podam as a production dependency as it will add alot of libs to the classpath, that are really only needed for testing.
In fact you don’t have to touch your production code if you’re not using Podam other than for testing.
You can create an attribute-level strategy as defined here:
On 13 May 2016, at 21:34, Tomas Bjerre notifications@github.com wrote:
Should I interpret the answer as no? I cannot see any annotation there that does exactly what factory.manufacturePojo(NotificationDTO.class) does. I think it would be nice to have an annotation that does that so that I can use in on an attribute in a unit test case.
Like here https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/blob/master/src/test/java/se/bjurr/prnfb/transformer/ButtonTransformerTest.java#L16. I'd like to move that variable to an attribute and annotate it instead of making that static call.
I really dont like the idea of adding Podam as a production dependency as it will add alot of libs to the classpath, that are really only needed for testing.
— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub https://github.com/mtedone/podam/issues/190#issuecomment-219152338
Some part of your comment got lost there right? =)
What I mean is here for example this:
@PodamStrategyValue(PostCodeStrategy.class)
private String postCode;
Is an attribute on a POJO from a production source folder right?
Apologies, I don’t understand what this email mean?
To customise your attribute values you can use annotations (legacy, these came with the first version of Podam) or by using attribute level strategies. If you’re using Podam just for testing you can keep the strategies in test code, if you are using it in production (like some do) you can keep the strategies as part of your production code.
On 13 May 2016, at 22:11, Tomas Bjerre notifications@github.com wrote:
Some part of you comment got lost there right? =)
What I mean is here http://mtedone.github.io/podam/annotations.html for example this:
@PodamStrategyValue(PostCodeStrategy.class) private String postCode; Is an attribute on a POJO from a production source folder right?
— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub https://github.com/mtedone/podam/issues/190#issuecomment-219160134
I am currently doing somehing like:
I want to do something like:
Where
I cant find it in the docs, is it possible? Would a PR for this be accepted?