Search in sources :

Example 1 with StubFooDao

use of example.scannable.StubFooDao in project spring-framework by spring-projects.

the class ClassPathBeanDefinitionScannerTests method testSimpleScanWithDefaultFiltersAndDefaultBeanNameClash.

@Test
public void testSimpleScanWithDefaultFiltersAndDefaultBeanNameClash() {
    GenericApplicationContext context = new GenericApplicationContext();
    ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
    scanner.setIncludeAnnotationConfig(false);
    try {
        scanner.scan("org.springframework.context.annotation3");
        scanner.scan(BASE_PACKAGE);
        fail("Should have thrown IllegalStateException");
    } catch (IllegalStateException ex) {
        // expected
        assertTrue(ex.getMessage().contains("stubFooDao"));
        assertTrue(ex.getMessage().contains(StubFooDao.class.getName()));
    }
}
Also used : GenericApplicationContext(org.springframework.context.support.GenericApplicationContext) StubFooDao(example.scannable.StubFooDao) Test(org.junit.Test)

Aggregations

StubFooDao (example.scannable.StubFooDao)1 Test (org.junit.Test)1 GenericApplicationContext (org.springframework.context.support.GenericApplicationContext)1