From: Steve F. <st...@m3...> - 2003-07-02 03:21:31
|
Tim Mackinnon wrote: > Not sure why the tests would be pain, isn't just a case of adding the two > following tests to mock? > > public void testProxyToStringWithNoToStringExpectation() throws Exception { > mockCallableAddable.addExpectedHasCall("toString", METHOD_NOARG_ARGS); > mockCallableAddable.setupHasCall(false); > > assertEquals("Should get mock name", MOCK_NAME, mock.proxy().toString()); > mock.verify(); > } no. If the methods are added as defaults on Mock, during construction, you have to fix the other tests so that calls to MockCallFactory.createReturnStub() don't fail because it's short of a return value. Which suggests that the callFactory is overspecified. > There is a smell, in some of the other tests because the CallFactory is a > bit over-used, it generates several types of stubs decorating each other (so > you have to set each of them up). I would say that this should be better > encapsulated so you just set one expectation on the mockCallFactory - the > tests would simplify and your code would be better. Exactly. S. |