|
|
|
@ -27,6 +27,7 @@ import org.springframework.beans.factory.config.BeanDefinition;
|
|
|
|
|
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
|
|
|
|
import org.springframework.context.ApplicationContext;
|
|
|
|
|
import org.springframework.context.ConfigurableApplicationContext;
|
|
|
|
|
import org.springframework.core.NativeDetector;
|
|
|
|
|
import org.springframework.core.Ordered;
|
|
|
|
|
import org.springframework.test.context.TestContext;
|
|
|
|
|
import org.springframework.test.context.TestExecutionListener;
|
|
|
|
@ -53,14 +54,14 @@ public class ResetMocksTestExecutionListener extends AbstractTestExecutionListen
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void beforeTestMethod(TestContext testContext) throws Exception {
|
|
|
|
|
if (MOCKITO_IS_PRESENT) {
|
|
|
|
|
if (MOCKITO_IS_PRESENT && !NativeDetector.inNativeImage()) {
|
|
|
|
|
resetMocks(testContext.getApplicationContext(), MockReset.BEFORE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void afterTestMethod(TestContext testContext) throws Exception {
|
|
|
|
|
if (MOCKITO_IS_PRESENT) {
|
|
|
|
|
if (MOCKITO_IS_PRESENT && !NativeDetector.inNativeImage()) {
|
|
|
|
|
resetMocks(testContext.getApplicationContext(), MockReset.AFTER);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|