Example test for
AccountDAO . The involved resource adaper
works with indexed records, so we can use the
com.mockrunner.connector.IndexedRecordInteraction for
the test. We simply prepare some names and the corresponding
ids, the simulated resource adapter should return. The
com.mockrunner.connector.IndexedRecordInteraction creates
suitable IndexedRecord implementations for the provided
lists. If the actual request matches the prepared list data, the
corresponding response IndexedRecord is returned.
This example test also demonstrates how to test the failure case.
The
com.mockrunner.connector.GenericFailureInteraction throws an exception which causes the
AccountDAO to roll back the
transaction and to return -1.