java - Is there a way to store a dynamodb object for unit tests -
i running lambda function @ point in code receives following object dynamodb:
itemcollection<scanoutcome>
i run function passing in object, want implement 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 hard me recreate test version of 'itemcollection ' in run-time. wondering if instead, can somehow save 1 serializing it, , store locally? , re-instantiate in run-time during unit tests?
similar how in javascript, store json object representation text/json file , reuse later.
is recommended/wise approach? ideal way resolve problem this?
an alternative solution run dynamodb instance locally, seen here: easier dynamodb local testing
Comments
Post a Comment