Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.6-rc-1, 1.5.8, 1.7-beta-1
-
Component/s: mocks and stubs
-
Labels:None
-
Testcase included:yes
-
Number of attachments :
Description
The following script leads to an exception. The closure does not delegate to the Mock.
import groovy.mock.interceptor.StubFor class Foo { def createBar() { throw new RuntimeException("We should never get here!") } } StubFor fooStub = new StubFor(Foo) fooStub.demand.createBar { "I'm a mock" } Closure closure = { createBar() } fooStub.use { Foo foo = new Foo() assert "I'm a mock" == foo.createBar() closure.delegate = foo assert "I'm a mock" == closure.call() }
Activity
Paul King
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Component/s | mocks and stubs [ 13113 ] |
Roshan Dawrani
made changes -
| Attachment | 2271Patch_v16X.txt [ 37601 ] |
Roshan Dawrani
made changes -
| Assignee | Roshan Dawrani [ roshandawrani ] |
Roshan Dawrani
made changes -
| Fix Version/s | 1.6-rc-1 [ 14009 ] | |
| Fix Version/s | 1.7-beta-1 [ 14014 ] | |
| Fix Version/s | 1.5.8 [ 14630 ] | |
| Fix Version/s | 1.6 [ 13832 ] | |
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Resolution | Fixed [ 1 ] |
Paul King
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |