Closed bam-hbt closed 1 year ago
Thanks for the issue. I've created a test for this: https://github.com/DaGeRe/peass/commit/10b824abe79bb1bc8c85d6b77dae3ec8814177c2 and will fix this now.
Starting with https://github.com/DaGeRe/peass/commit/3013ed193e6a61abe7f64099529cdc65a8142112, this should fully work. Could you test this?
Thanks for fix, looks fine.
To clarify this for future reference: This was about having mock initializing directly at field declaration, e.g.
public class MyTest {
public static final Object myMock = Mockito.mock(Object.class);
@Test
public void doSomething(){
Assert.assertEquals("asdasd", mock.toString());
}
}
To fix this, the initialization needs to be moved to the @BeforeAll
method (or, in case of a field variable, to @BeforeEach
).
There is no relation to mockito-inline.
What feature do you want to see added?
If the class is mocked-inline, after clean up mockito caches the mocked obj will be lost.
Upstream changes
No response