@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()); }
@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); }
@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); }
@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); }
@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); }
@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); }
private void assertLocationsBarAttributes(ContextConfigurationAttributes attributes) { assertAttributes(attributes, LocationsBar.class, new String[] { "/bar.xml" }, EMPTY_CLASS_ARRAY, AnnotationConfigContextLoader.class, true); }
private void assertClassesBarAttributes(ContextConfigurationAttributes attributes) { assertAttributes(attributes, ClassesBar.class, EMPTY_STRING_ARRAY, new Class<?>[] { BarConfig.class }, AnnotationConfigContextLoader.class, true); }