Looks rather complex. Maybe this class can help you: http://www.rexsl.com/rexsl-test/apidocs-0.11/com/rexsl/test/mock/MkContainer.html