Cookie code: overriding and getting back the method behavior


Working with Stub and Mock objects in Groovy has been a very interesting (and fun) task to me. Today I needed to modify a method’s behavior for an integration test avoiding unnecessary remote calls however the next test should be performed using the remote behavior (strange, but…).

So, for this solution I simply changed the method’s execution in run time using meta programming, easy. The problem was: how to do the rollback to the original state? After some researches I found two ways that I would like to share:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s