This repository was archived by the owner on Sep 3, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
datajack-api/src/main/java/ru/sbtqa/tag/datajack/providers
providers/json-provider/src/test/java/ru/sbtqa/tag/datajack/providers/json Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -301,6 +301,19 @@ public String getValue() throws DataException {
301301
302302 result = this .basicObject .getString (this .way );
303303 }
304+ if (result == null ) {
305+ this .basicObject .keySet ().stream ().forEach (s -> {
306+ try {
307+ AbstractDataProvider instance = createInstance (basicObject , collectionName , way + "." + s );
308+ instance .applyGenerator (callback );
309+ this .basicObject .put (s , instance .getValue ());
310+ } catch (DataException e ) {
311+ e .printStackTrace ();
312+ }
313+
314+ });
315+ result = basicObject .toString ();
316+ }
304317 return applyCallBackData (result );
305318 }
306319
Original file line number Diff line number Diff line change 11package ru .sbtqa .tag .datajack .providers .json ;
22
33import com .mongodb .BasicDBObject ;
4+ import org .junit .Assert ;
45import org .junit .Before ;
56import org .junit .Rule ;
67import org .junit .Test ;
@@ -162,12 +163,8 @@ public void getByPathArrayTest() throws DataException {
162163 TestDataProvider testDataProvider = new JsonDataProvider (JSON_DATA_PATH , collectionName );
163164 testDataProvider .applyGenerator (SampleDataGensCallback .class );
164165
165- String value = testDataProvider .getByPath ("$Tests{array[0]}" ).getValue ();
166- String valueArrayObject = testDataProvider .getByPath ("${array[1].b}" ).getValue ();
167-
168- assertEquals ("a" , value );
169- assertEquals ("1" , valueArrayObject );
170- assertEquals (testDataProvider .get ("array" ).toString (), testDataProvider .getByPath ("$Tests{array}" ).toString ());
166+ String value = testDataProvider .getByPath ("$Tests{Common}" ).getValue ();
167+ Assert .assertNotNull (value );
171168 }
172169
173170 @ Test
You can’t perform that action at this time.
0 commit comments