From: Jeff M. <je...@mk...> - 2002-09-13 10:58:35
|
On Fri, 2002-09-13 at 11:28, Simon Levitt wrote: > On Friday 13 September 2002 10:36, Jeff Martin wrote: > > One problem you might come across is circular verifications. It's a > > problem we had here where you can add a statement to a connection and > > then the connection to the statement. When you call verify the whole > > thing goes into a loop. > > > About 30 seconds before this arrived I was sitting here trying to work out > why that exact problem had occurred! - Thanks a lot - Thats saved me > ages! > ;-) Did I mention I'm a clairvoyant in my spare time. > Is that the reason a MockStatement wasn't automatically associated with > the Connection its added to? One of the changes I've made locally is to > do this (for ResultSets and their Statement as well). It's a general policy to not have mocks manage the relationships with other mocks. The idea is to keep the mocks as simple as possible. This is the reason I've started work on the test helper classes which setup the tree of mocks for you. Though I've not produced any for the JDBC classes as it's more complex than the servlet api. > > > The way to get around it is probably to change verify to build up a > > verification set by adding it's children to it and then verifying > > everything in the set. > > > Wouldn't it be easier for the Verifier to keep a list of objects its in > the process of verifying and not allow the same one twice (silently > doesn't bother)? Don't think this helps if the dependency is more than one level deep. > > Making Verifier.verifyObject synchronized would stop problems with > multiple threads verifying at the same time (why you'd do that I don't > know though). Tempted to say forget thread safety (That's not to say it's okay to have static variables.). > > > You may not hit this problem but it's possible that these sort of > > changes would increase the chances of it happening. > > > Thanks again for the quick spot!. > > Cheers, > > Simon., > -- > -------------------------------------------------------------------------- > Simon Levitt, Senior Development Engineer @ WorldPay plc, > WorldPay Centre, The Science Park, Milton Rd., Cambridge, CB4 0WE, ENGLAND > Sim...@uk... Ph:+44(0)1223 715151 F:+44(0)1223 715157 > ------------------------- http://www.worldpay.com/ ----------------------- > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev -- jeff martin information technologist mkodo limited mobile: 44 (0) 78 5547 8331 phone: 44 (0) 20 2226 4545 email: je...@mk... www.mkodo.com |