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.