Java 类org.springframework.test.context.support.AnnotationConfigContextLoader 实例源码

项目:spring4-understanding    文件:MergedContextConfigurationTests.java   
@Test
public void hashCodeWithEmptyArraysAndDifferentLoaders() {
    MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(),
            EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
    MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
            EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, new AnnotationConfigContextLoader());
    assertNotEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode());
}
项目:spring4-understanding    文件:MergedContextConfigurationTests.java   
@Test
public void equalsWithEmptyArraysAndDifferentLoaders() {
    MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(),
            EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
    MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
            EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, new AnnotationConfigContextLoader());
    assertNotEquals(mergedConfig1, mergedConfig2);
    assertNotEquals(mergedConfig2, mergedConfig1);
}
项目:class-guard    文件:MergedContextConfigurationTests.java   
@Test
public void hashCodeWithEmptyArraysAndDifferentLoaders() {
    MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY,
        EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
    MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY,
        EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, new AnnotationConfigContextLoader());
    assertNotEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode());
}
项目:class-guard    文件:MergedContextConfigurationTests.java   
@Test
public void equalsWithEmptyArraysAndDifferentLoaders() {
    MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY,
        EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
    MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY,
        EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, new AnnotationConfigContextLoader());
    assertNotEquals(mergedConfig1, mergedConfig2);
    assertNotEquals(mergedConfig2, mergedConfig1);
}
项目:class-guard    文件:ContextLoaderUtilsTests.java   
@Test
public void buildMergedConfigWithLocalAndInheritedAnnotationsAndLocations() {
    Class<?> testClass = LocationsBar.class;
    String[] expectedLocations = new String[] { "/foo.xml", "/bar.xml" };

    MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass, null, null);
    assertMergedConfig(mergedConfig, testClass, expectedLocations, EMPTY_CLASS_ARRAY,
        AnnotationConfigContextLoader.class);
}
项目:class-guard    文件:ContextLoaderUtilsTests.java   
@Test
public void buildMergedConfigWithLocalAndInheritedAnnotationsAndClasses() {
    Class<?> testClass = ClassesBar.class;
    Class<?>[] expectedClasses = new Class<?>[] { FooConfig.class, BarConfig.class };

    MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass, null, null);
    assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, expectedClasses,
        AnnotationConfigContextLoader.class);
}
项目:class-guard    文件:ContextLoaderUtilsTests.java   
@Test
public void buildMergedConfigWithAnnotationsAndOverriddenLocations() {
    Class<?> testClass = OverriddenLocationsBar.class;
    String[] expectedLocations = new String[] { "/bar.xml" };

    MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass, null, null);
    assertMergedConfig(mergedConfig, testClass, expectedLocations, EMPTY_CLASS_ARRAY,
        AnnotationConfigContextLoader.class);
}
项目:class-guard    文件:ContextLoaderUtilsTests.java   
@Test
public void buildMergedConfigWithAnnotationsAndOverriddenClasses() {
    Class<?> testClass = OverriddenClassesBar.class;
    Class<?>[] expectedClasses = new Class<?>[] { BarConfig.class };

    MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass, null, null);
    assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, expectedClasses,
        AnnotationConfigContextLoader.class);
}
项目:class-guard    文件:ContextLoaderUtilsTests.java   
private void assertLocationsBarAttributes(ContextConfigurationAttributes attributes) {
    assertAttributes(attributes, LocationsBar.class, new String[] { "/bar.xml" }, EMPTY_CLASS_ARRAY,
        AnnotationConfigContextLoader.class, true);
}
项目:class-guard    文件:ContextLoaderUtilsTests.java   
private void assertClassesBarAttributes(ContextConfigurationAttributes attributes) {
    assertAttributes(attributes, ClassesBar.class, EMPTY_STRING_ARRAY, new Class<?>[] { BarConfig.class },
        AnnotationConfigContextLoader.class, true);
}