Prevent a broken factory bean from breaking the resetting of mocks

Closes gh-7271
pull/7529/head
Aleksander Bartnikiewicz 8 years ago committed by Andy Wilkinson
parent e19c6245ef
commit eb927f1b29

@ -65,7 +65,7 @@ public class ResetMocksTestExecutionListener extends AbstractTestExecutionListen
for (String name : names) { for (String name : names) {
BeanDefinition definition = beanFactory.getBeanDefinition(name); BeanDefinition definition = beanFactory.getBeanDefinition(name);
if (definition.isSingleton() && instantiatedSingletons.contains(name)) { if (definition.isSingleton() && instantiatedSingletons.contains(name)) {
Object bean = beanFactory.getBean(name); Object bean = beanFactory.getSingleton(name);
if (reset.equals(MockReset.get(bean))) { if (reset.equals(MockReset.get(bean))) {
Mockito.reset(bean); Mockito.reset(bean);
} }

Loading…
Cancel
Save