I am running a lambda function which at some point in the code receives the following object from DynamoDb:
ItemCollection<ScanOutcome>
I then run this function passing in this object, which I want to implement a unit test for:
public String deleteItems(ItemCollection<ScanOutcome> items) {
    ...
    Iterator<Item> iterator = items.iterator();
    while (iterator.hasNext()) {
        Item item = iterator.next();
        Object id = item.get("Id");
        DeleteItemSpec itemSpec = new DeleteItemSpec().withPrimaryKey("Id", id);
        someDynamoTable.deleteItem(itemSpec);
        ...
    }
    ...
}
The problem is that it is hard for me to recreate a test version of 'ItemCollection ' in run-time. I am wondering if instead, I can somehow save one by serializing it, and store it locally? and then re-instantiate it in run-time during my unit tests?
Similar to how in Javascript, I could just store a JSON object representation to a text/json file and reuse it later.
Is this a recommended/wise approach? What would be the ideal way to resolve a problem like this?
An alternative solution is to run a dynamoDb instance locally, as seen here: Easier DynamoDB local testing