Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.8.2
-
None
Description
Hi Everyone
I'm using Groovy 1.8.2, and there's a variant of http://jira.codehaus.org/browse/GROOVY-4884. This code fails for me:
import org.junit.Test; public class BreakingExample_NoMetaclassOverride { @Test void testNotOverriden() { def list = [] ClassUnderTest cut = new ClassUnderTest() cut.metaClass.getRemoteObject = { -> return [method: {obj -> list << obj }] as RemoteObject } String val = "Value" cut.someMethod(val) assert list == [val] } } public class ClassUnderTest extends RemoteObject { public def someMethod(String someValue) { RemoteObject object = getRemoteObject() object.method(someValue) } protected RemoteObject getRemoteObject() { return new RemoteObject() } } public class RemoteObject { public void method(obj) { /* Something */ } }
The only difference between this and #4884 is the "extends RemoteObject" added to ClassUnderTest. With it in, the test fails. Remove it, the test passes.
Please let me know if you need any more info!
Thanks
Jason Griffith