Hi Ilya,

the PR has been applied and pushed.    Very nice work!

One question though:  what happens if you have more than one Json DTO object?  

Can you please provide another PR dealing with this scenario? 

Thanks,
Mauro

> On 31 Dec 2016, at 13:48, Ilya Skapchuk <[email protected]> wrote:
> 
> Hi.
> I've added new pull request 
> <https://github.com/jbehave/jbehave-core/pull/134>. Please review.
> 
> Let's discuss if smth could be changed.
> 
> Thank you and Happy New Year! 
> 
> On Wednesday, December 14, 2016 at 5:56:12 PM UTC+2, Ilya Skapchuk wrote:
> Hello community.
> 
> On my current project we work with Jsons a lot.
> 
> One day I got an idea that it will be great to be able to use Jsons as a test 
> data which will be automatically converted to Java objects (DTOs) when you 
> pass this data from story file.
> 
> (Like ExamplesTableParametersConverter which automatically converts example 
> tables/files with example tables to Java objects (DTOs) via @AsParameters 
> annotation when you pass it from story file)
> 
> 
> We created our own converter called JsonConverter which allows to 
> automatically convert Json strings/files to Java objects (DTOs). 
> (ExamplesTableParametersConverter was taken as a basis wen we were creating 
> it)
> 
> JsonConverter usage example:
> We added new annotation (like @AsParameters) called @AsJson.
> 
> JBehave story:
> 
>  
> Then actual data should be as dataFolder/dataFile.json data
> 
> or
> 
>       Then actual data should be as {"variable1": "value1", "variable2": 
> "value2"} data
> …
> 
>  
> Java definition:
> 
>  
> @Then("actual data should be as $expectedJson data")
> 
> public void checkJsonData(final JsonDTO expectedJson) {
> 
> 
>     //assert expectedJson equals to actual json of JsonDTO.class type...
> 
> }
> …
> 
>  
> 
> Java DTO:
> 
>  
> @AsJson
> 
> public class JsonDTO {
> 
> 
>     private String variable1;
> 
>     private String variable2;
> 
> 
> 
> }
>               …
> 
> MY QUESTIONS ARE:
> 
> 1. Is it worth to add JsonConverter to jbehave-core through pull request?
> 
> 2. Is it better to use @AsParameters for JsonConverter instead of own @AsJson 
> annotation to be able to convert both examples tables and Jsons to the same 
> Java object (DTO). (requires much more logic changes in jbehave-core code).
> 
> 
> Link to existing Jbehave Parameters Converter 
> <http://jbehave.org/reference/stable/parameter-converters.html>
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "JBehave Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web, visit 
> https://groups.google.com/d/msgid/jbehave-dev/bb2a57cf-50a9-44d8-abd8-029fc452812d%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jbehave-dev/bb2a57cf-50a9-44d8-abd8-029fc452812d%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"JBehave Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send an email to [email protected].
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/jbehave-dev/68715232-EAF2-4D02-AB09-7C31883D8CFE%40aquilonia.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to