google / error-prone

Catch common Java mistakes as compile-time errors
https://errorprone.info
Apache License 2.0
6.83k stars 741 forks source link

False positive for DirectInvocationOnMock #3396

Open moonfruit opened 2 years ago

moonfruit commented 2 years ago

Code like this should be allowed for DirectInvocationOnMock:

import static org.mockito.Mockito.mock;
import static org.mockito.BDDMockito.given;

@Test
void test() {
    Caller caller = mock(Caller.class);
    given(caller.call()).willReturn(1);
}
RobertTheBlair commented 1 year ago

Thanks for creating this issue. I was going to make one. Is this still under consideration?

RobertTheBlair commented 1 year ago

https://github.com/google/error-prone/pull/3731 will address this issue Hope it's not too late @moonfruit

RobertTheBlair commented 1 year ago

Still looking to get this reviewed & approved - everything should be ready, except the build does not pass as I've not been approved by a maintainer to run workflows.