Steve Freeman | 4 Jun 2007 09:18
Picon

Re: TDD and WeakReferences

It sounds more like a little integration test, since the results  
depend on a combination of the VM (including its settings) and hardware.

S.

On 1 Jun 2007, at 00:55, Rick Mugridge wrote:
> Sure, I don't need to use WeakReferences, but they appear to be an
> elegant solution. The alternative is to explicitly deregister all  
> of the
> listeners associated with a dead View.
>
> I've now sorted the failing spike. The Java docs are wrong, as
> System.gc() is advertised as "When control returns from the method  
> call,
> the Java Virtual Machine has made a best effort to reclaim space from
> all discarded objects." However, it actually uses a separate thread  
> for
> gc on a multi-cpu machine. So I have to put a delay in the test (I
> actually poll for up to 1 sec to see the results I expect).
>
> It's a bother that it's "best effort", as I'd rather like my unit  
> tests
> to be deterministic!
>

Steve Freeman
http://www.mockobjects.com

Winner of the Agile Alliance Gordon Pask award 2006

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/testdrivendevelopment/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/testdrivendevelopment/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:testdrivendevelopment-digest <at> yahoogroups.com 
    mailto:testdrivendevelopment-fullfeatured <at> yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    testdrivendevelopment-unsubscribe <at> yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/


Gmane