title: How can I save a method for later, stubbing it for a period of time?
body: <p>I'm writing a selenium-aid for a web application, and for one of the functions, I'm stubbing away the responses of a grails service. Is there any way to persist the methods for later, such that I can turn the service "back on"? The idea is that my test-aid code can be completely separated from production code, and no test-aids leak into the real service layer.</p>
  
  <p>This works fine for turning the service "off", but getting it back on is an issue.</p>
  
  <p>I'm doing this:</p>
  
  <pre><code>myService.metaClass.method1 = {true}
  myService.metaClass.method2 = {false}
  </code></pre>
  
  <p>I tried just storing <code>myService.metaClass.method1</code>, but attempting to set it later just leaves the method stub. </p>
  
  <p>How can I store <code>method1</code> and <code>method2</code> for later?</p>