CE-781 Update to work without a table specified (just getting field names from the json keys)

This commit is contained in:
2024-01-08 12:39:43 -06:00
parent a00d4f3cbd
commit 06259041f8
2 changed files with 38 additions and 5 deletions

View File

@ -164,6 +164,29 @@ class JsonToQRecordAdapterTest extends BaseTest
/*******************************************************************************
**
*******************************************************************************/
@Test
public void test_buildRecordsFromJsonWithoutTable_inputList()
{
JsonToQRecordAdapter jsonToQRecordAdapter = new JsonToQRecordAdapter();
List<QRecord> qRecords = jsonToQRecordAdapter.buildRecordsFromJson("""
[
{ "firstName":"Tyler", "last":"Samples" },
{ "firstName":"Tim", "lastName":"Chamberlain" }
]
""", null, null);
assertNotNull(qRecords);
assertEquals(2, qRecords.size());
assertEquals("Tyler", qRecords.get(0).getValue("firstName"));
assertEquals("Samples", qRecords.get(0).getValue("last"));
assertEquals("Tim", qRecords.get(1).getValue("firstName"));
assertEquals("Chamberlain", qRecords.get(1).getValue("lastName"));
}
/*******************************************************************************
**
*******************************************************************************/