From: <DeS...@em...> - 2003-08-27 12:10:51
|
Hello, I must have scanned all documentation on the wiki by now, but I still don't know how to do something simple like defining an expected invocation of a method on a dynamic mock. I have the following interface: public interface CallSemantics { Pluxie configure(Pluxie pluxieToConfigure); } And I'm testing that following method delegates to a CallSemantics object: Pluxie configurePluxie(Pluxie pluxieToConfigure) { // The 'callSemantics' object is a member. return callSemantics.configure(pluxieToConfigure); } Well, the real production method has some more lines, but I want to keep my question simple. In my unit test, I define a mock of CallSemantics and mention that it should expect an invocation of the configure method with a Pluxie object as an argument. However, I just can't figure out how to write this expectation using dynamic mocks: Mock semanticsMock = new Mock(CallSemantics.class); // How to define the expectation here? CallSemantics callSemanticsMock = (CallSemantics) semanticsMock.proxy(); What should I write to define that I want one invocation of the method with signature public Pluxie configure(Pluxie) Oh, I want the mock to return the given argument unmodified! Ringo |