From: Nat P. <nat...@b1...> - 2003-12-17 15:33:25
|
On Wed, 2003-12-17 at 15:03, J. Xue wrote: > Quoting Nat Pryce <nat...@b1...>: > > > Can't you mock the unmarshaller? > > Well I thought about that, but first of all, wouldn't it go against the "Only > Mock Your Own Interface" pattern? Yes. And if you're going to only mock your own interfaces the whole problem goes away, doesn't it? But if you're not, then this would be a workaround > Secondly, that'd require ClassUnderTest to > call an adapter instead of calling the real unmarshaller directly (or do I just > make the mock unmarshaller in the castor package and shadow the real one on the > classpath?) I wasn't sure either way would be a good idea... ClassUnderTest would call an interface to perform unmarshalling. It wouldn't care if the implementation of the interface was an adapter or a direct implementation. Whichever approach you take (adapter or mocking castor), you'd put the mock unmarshaller into your own test package. There's no need to touch the castor packages. Cheers, Nat. |