diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/ResetMocksTestExecutionListenerTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/ResetMocksTestExecutionListenerTests.java index 025058aff32..e28ce99623c 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/ResetMocksTestExecutionListenerTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/ResetMocksTestExecutionListenerTests.java @@ -21,6 +21,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.MethodSorters; +import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.mock.mockito.example.ExampleService; import org.springframework.context.ApplicationContext; @@ -37,6 +38,7 @@ import static org.mockito.Mockito.mock; * Tests for {@link ResetMocksTestExecutionListener}. * * @author Phillip Webb + * @author Andy Wilkinson */ @RunWith(SpringRunner.class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) @@ -94,6 +96,31 @@ public class ResetMocksTestExecutionListenerTests { throw new RuntimeException(); } + @Bean + public BrokenFactoryBean brokenFactoryBean() { + // gh-7270 + return new BrokenFactoryBean(); + } + + } + + static class BrokenFactoryBean implements FactoryBean { + + @Override + public String getObject() throws Exception { + throw new IllegalStateException(); + } + + @Override + public Class getObjectType() { + return String.class; + } + + @Override + public boolean isSingleton() { + return true; + } + } }