diff --git a/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java index ea034ebb89..5330efae5d 100644 --- a/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java +++ b/spring-autoconfigure/src/test/java/org/springframework/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java @@ -94,15 +94,13 @@ public class HibernateJpaAutoConfigurationTests { public void testOpenEntityManagerInViewInterceptorNotRegisteredWhenFilterPresent() throws Exception { AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); - context.register(ComponentScanDetectorConfiguration.class, + context.register(TestFilterConfiguration.class, + ComponentScanDetectorConfiguration.class, EmbeddedDatabaseConfiguration.class, HibernateJpaAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class, TestFilterConfiguration.class); + PropertyPlaceholderAutoConfiguration.class); this.context = context; this.context.refresh(); - assertEquals( - 0, - this.context - .getBeanNamesForType(OpenEntityManagerInViewInterceptor.class).length); + assertEquals(0, getInterceptorBeans().length); } @Test @@ -116,10 +114,11 @@ public class HibernateJpaAutoConfigurationTests { PropertyPlaceholderAutoConfiguration.class); this.context = context; this.context.refresh(); - assertEquals( - 0, - this.context - .getBeanNamesForType(OpenEntityManagerInViewInterceptor.class).length); + assertEquals(0, getInterceptorBeans().length); + } + + private String[] getInterceptorBeans() { + return this.context.getBeanNamesForType(OpenEntityManagerInViewInterceptor.class); } @ComponentScan(basePackageClasses = { City.class })