java - EasyMock: Method with a callback argument -
i have situation this:
class { void methoda(callback cb) { ... cb.onresult(result); } } class b { void methodb(a a) { a.methoda(new callback() { void onresult(result r) { ... } }); } }
and question is: how can test "b.methodb" different "result" easymock?
you capture
callback
passed methoda
capture<callback> cap = new capture<callback>(); mocka.methoda(capture(cap)); replay(mocka); instanceofb.methodb(mocka); callback cb = cap.getvalue(); // can call cb.onresult mocked result instance
Comments
Post a Comment