@Test public void detectsMultipleAutoConfigurationPackages() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( FirstConfiguration.class, SecondConfiguration.class); List<String> packages = AutoConfigurationPackages.get(context.getBeanFactory()); Package package1 = FirstConfiguration.class.getPackage(); Package package2 = SecondConfiguration.class.getPackage(); assertThat(packages).containsOnly(package1.getName(), package2.getName()); }
@Test public void detectsMultipleAutoConfigurationPackages() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( FirstConfiguration.class, SecondConfiguration.class); List<String> packages = AutoConfigurationPackages.get(context.getBeanFactory()); Package package1 = FirstConfiguration.class.getPackage(); Package package2 = SecondConfiguration.class.getPackage(); assertThat(packages, hasItems(package1.getName(), package2.getName())); assertThat(packages, hasSize(2)); }