I have the following in a test setup:
def originalPostAsXml = RestClient.&postAsXml RestClient.metaClass.'static'.postAsXml = { String uriPath, String xml -> return 65536 }
and in test cleaning:
RestClient.metaClass.'static'.postAsXml = originalPostAsXml
But when the following test runs, when it tries to execute RestClient.postAsXml, it runs in a StackOverflowError:
at groovy.lang.Closure.call(Closure.java:282)
RestClient.postAsXml seems to recursively point to itself. What is the correct way to reset the exhausted static method?
source share