From: Vincent M. <vm...@pi...> - 2003-05-16 07:29:54
|
Hi, I've just noticed expectNotCalled() has been deprecated in the new DynaMock API. I am wondering why as I've found it quite useful. The javadoc says that "Not required, as if methodName is called, you will get a an exception". I think an example in the javadoc would have been more powerful an explanation. I'm not sure I understand... Here's the current test I am migrating: public void testGetOrderHomeFromCache() throws Exception { // First call to ensure the home is in the cache OrderUtil.getOrderHome(); // Make sure the lookup method is NOT called thus proving the object // is served from the cache jndiTestSetup.getMockContext().expectNotCalled("lookup"); OrderUtil.getOrderHome(); } What should it be now? I liked the expectNotCalled as it expressed very nicely what it means and what the test means. Handling this with an exception seems like a hack to me (and not conveying the test message at all), but I'd like to be proved wrong! :-) Thanks -Vincent |