From: Patrick L. <pli...@ci...> - 2002-12-17 19:07:26
|
I really like the dynamic mock stuff, but it seems there is a pretty major flaw: MockExceptedCalls are mapped using _only_ the methodName. That means I can't expect multiple values for different args on the same method: m.expectAndReturn("findByAndCache", C.args(C.eq(DocumentProblemType.ENTITY_NAME), C.IS_ANYTHING), UtilMisc.toList(dpt1, dpt2)); m.expectAndReturn("findByAndCache", C.args(C.eq(DocumentSubject.ENTITY_NAME), C.IS_ANYTHING), Collections.EMPTY_LIST); m.expectAndReturn("findByAndCache", C.args(C.eq(Publishaction.ENTITY_NAME), C.IS_ANYTHING), Collections.EMPTY_LIST); m.expectAndReturn("findByAndCache", C.args(C.eq(Reviewaction.ENTITY_NAME), C.IS_ANYTHING), Collections.EMPTY_LIST); This code doesn't work becuase the most recent expectation overrides the previous one, and my code ends up failing. Am I using the Mock object incorrectly, or is there a way around this? -Pat |