Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit 8503a4b

Browse files
committed
draft
1 parent 9864cc2 commit 8503a4b

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

datajack-api/src/main/java/ru/sbtqa/tag/datajack/providers/AbstractDataProvider.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff 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

providers/json-provider/src/test/java/ru/sbtqa/tag/datajack/providers/json/JsonDataTest.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package ru.sbtqa.tag.datajack.providers.json;
22

33
import com.mongodb.BasicDBObject;
4+
import org.junit.Assert;
45
import org.junit.Before;
56
import org.junit.Rule;
67
import 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

0 commit comments

Comments
 (0)