Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Not A Problem
-
1.7.3
-
None
-
None
Description
Attempting to use instructions in http://docs.codehaus.org/display/GROOVY/Using+MockFor+and+StubFor to mock a static method.
I get groovy.lang.MissingPropertyException: No such property: static for class: groovy.mock.interceptor.Demand
in:
import groovy.mock.interceptor.StubFor class StorefrontService { String useStaticMethod(String forDeviceModel) { return Compatibility.list(forDeviceModel) } } class Compatibility { static def list(String deviceModel) { return 'static-' + it } } def mock = new StubFor(Compatibility) mock.demand.static.list { return 'static-mock-' + deviceModel } mock.use { println new StorefrontService().useStaticMethod('bc') }