Skip to content

Using withCapture prevents missing invocation error when times = 1 specified #27

@kumick

Description

@kumick

Trying to use withCapture to validate the object passed to a method, but if the method is never called a null pointer exception is raised on the assert statement following the withCapture instead of a missing invocation error. The missing invocation is a preferred response since it clearly states that the method was never called.

Code snipet where ops is a mocked object. Ops is not used in any Expectations prior to verification. And the current implementation does not call ops.add(alarm).
new Verifications() {{
Alarm alarm;
ops.add(alarm = withCapture());
times = 1;
assertEquals(...
}}

Using version 1.10.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions