79521108

Date: 2025-03-19 18:44:08
Score: 1
Natty:
Report link

You can store the AutoCloseable instance and close it explicitly in an @AfterEach method:

private AutoCloseable closeable;

@BeforeEach
void setUp() {
    closeable = MockitoAnnotations.openMocks(this);
}

@AfterEach
void tearDown() throws Exception {
    closeable.close();
}
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Miguel Angel Gonzalez