File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed 
aquality-selenium-template-cucumber/src/test/java/aquality/selenium/template/cucumber/transformations Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change 11package  aquality .selenium .template .cucumber .transformations ;
22
3- import  aquality .selenium .template .models .ContactUsInfo ;
4- import  io .cucumber .java .DataTableType ;
3+ import  com .fasterxml .jackson .databind .JavaType ;
4+ import  com .fasterxml .jackson .databind .ObjectMapper ;
5+ import  io .cucumber .java .DefaultDataTableEntryTransformer ;
56
7+ import  java .lang .reflect .Type ;
68import  java .util .Map ;
79
810public  class  DataTableTypeTransformations  {
911
10-  @ DataTableType 
11-  public  ContactUsInfo  getContactUsInfo (Map <String , String > entry ) {
12-  ContactUsInfo  contactUsInfoModel  = new  ContactUsInfo ();
13-  contactUsInfoModel .setName (entry .get ("Name" ));
14-  contactUsInfoModel .setCompany (entry .get ("Company" ));
15-  contactUsInfoModel .setPhone (entry .get ("Phone" ));
16-  contactUsInfoModel .setComment (entry .get ("Comment" ));
17-  return  contactUsInfoModel ;
12+  private  final  ObjectMapper  mapper  = new  ObjectMapper ();
13+ 
14+  @ DefaultDataTableEntryTransformer 
15+  public  Object  transformDataTable (Map <String , String > entry , Type  toValueType ) {
16+  JavaType  constructedType  = mapper .constructType (toValueType );
17+  return  mapper .convertValue (entry , constructedType );
1818 }
1919}
                                 You can’t perform that action at this time. 
               
                  
0 commit comments