From: Vincent M. <vm...@oc...> - 2003-02-16 21:07:30
|
Hi, I have the following use case: 1/ I have a lookup() method 2/ The first time the code under test is executed, the lookup method is called 3 times 3/ The second time (and all time thereafter) the code under test is executed, the lookup method is only called twice (because a static flag has been set) 4/ I can't remove the static flag (because I'm writing a tutorial which needs this static flag) 5/ I would much much prefer not to have to order my testXXX() methods My question is: how can I set this up using Dyna Mocks? If I write: CallSequence sequence = new CallSequence(); sequence.expectReturn(OrderUtil.ORDER_LOCALHOME, orderLocalHome); sequence.expectReturn(JNDINames.QUEUE_ORDER, queue); sequence.expectReturn(JNDINames.QUEUE_CONNECTION_FACTORY, queueConnectionFactory); mockContext.setup("lookup", sequence); Then, it does not work the second time as the first lookup is skipped in the execution code (because of the flag). Does anyone have a "CallGroup" java class that would perform the same as CallSequence but with no ordering nor expectation on the calls? Thanks -Vincent |