Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

capture(Capture) only captures last method call #21

Closed
henri-tremblay opened this issue Jun 3, 2015 · 0 comments
Closed

capture(Capture) only captures last method call #21

henri-tremblay opened this issue Jun 3, 2015 · 0 comments
Assignees
Labels
Milestone

Comments

@henri-tremblay
Copy link
Contributor

@henri-tremblay henri-tremblay commented Jun 3, 2015

Migrated from: CodeHaus issue EASYMOCK-10
Original reporter: Henri Tremblay


Code sample:

SomeObject obj = createMock(SomeObject.class);

Capture cap1 = new Capture();
Capture cap2 = new Capture();

obj.doSomething(eq("test"), capture(cap1));
obj.doSomething(eq("anotherTest"), capture(cap2));

replay(obj);

obj.doSomethingToCauseMethodCalls();

verify(obj);

Problem:

The object returned from cap1.getValue() == cap2.getValue(). Or - to be more precise - no matter which capture object you use the only value returned from getValue() will be the last captured value.

Probably some static state thing but didn't seem like this is what you guys intended.

@henri-tremblay henri-tremblay self-assigned this Jun 3, 2015
@henri-tremblay henri-tremblay added this to the 2.5 milestone Jun 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.