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

Commit

Permalink
Merge pull request #43 from sbtqa/issue42
Browse files Browse the repository at this point in the history
Fix array wrong stringify
  • Loading branch information
kosteman authored Jul 14, 2023
2 parents b5e6d0c + f30394a commit 6100da9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,9 @@ private DBObject resolveDbObject() throws DataException {
if (instance.basicObject.keySet().contains(key) && instance
.basicObject.get(key) == null) {
resolvedDbObject.put(key, null);
}else if(basicObject.get(key) instanceof BasicDBList){
BasicDBList array = (BasicDBList) basicObject.get(key);
resolvedDbObject.put(key, array);
} else {
resolvedDbObject.put(key, instance.getValue());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ public void differentExtensionTest() throws DataException {
testDataProvider.get("Common.password2").getValue());
}

@Test
public void issue42() throws DataException {
String collectionName = "issue";
TestDataProvider testDataProvider = new JsonDataProvider(JSON_DATA_PATH, collectionName, "json");
assertEquals("{ \"systemId\" : \"QJ160\" , \"customerIds\" : [ { \"id\" : \"93V\" , \"branch\" : \"Cu19\"}]}",
testDataProvider.get("X-User").getValue());
}

@Test
public void simpleArrayTest() throws DataException {
String collectionName = "Tests";
Expand Down
11 changes: 11 additions & 0 deletions providers/json-provider/src/test/resources/json/issue.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"X-User": {
"systemId": "QJ160",
"customerIds": [
{
"id": "93V",
"branch": "Cu19"
}
]
}
}

0 comments on commit 6100da9

Please sign in to comment.