Java Mailing List Archive

http://www.gg3721.com/

Home » user.groovy »

[groovy-user] Re[groovy-user] move meta class overriding

nickcodefresh

2008-08-12

Replies: Find Java Web Hosting

Author LoginPost Reply

Hi,

In my unit test I'm overriding the get static method with the following:

User.metaClass.static.get = {Integer id -> return null}

When I run my test suite, this overriding affects other tests that call
User.get(). I therefore need to call
GroovySystem.metaClassRegistry.removeMetaClass.remove User in tearDown(),
but this appears to remove all of the dynamically added methods from User
(my other unit test says the method get() not found).

How do I get round this?

Thanks

Nick
--
Sent from the groovy - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


©2008 gg3721.com - Jax Systems, LLC, U.S.A.