When this test is executed:
public final class WithCaptureTest
{
@Test
public void captureNullToLocalVariable() {
dao.doSomething((Integer)null);
new Verifications() {{
Integer i;
dao.doSomething(i = withCapture());
assertNull(i);
}};
}
}
i is assigned with 0 value instead of null.
I tracked this down to this line: mockit/internal/expectations/ActiveInvocations.java:96
and it seems like it was introduced as a fix for NPE for "certain misuses of the argument matching/capturing". Is it an intended behavior?
Workaround would be to use withCapture(List) which seems to handle null values properly (#567)
Version of JMockit that was used: 1.46
Description of the problem or enhancement request:
When this test is executed:
iis assigned with0value instead ofnull.I tracked this down to this line: mockit/internal/expectations/ActiveInvocations.java:96
and it seems like it was introduced as a fix for NPE for "certain misuses of the argument matching/capturing". Is it an intended behavior?
Workaround would be to use
withCapture(List)which seems to handlenullvalues properly (#567)