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

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -