|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2013 the original author or authors. |
|
|
|
* Copyright 2002-2014 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -41,8 +41,10 @@ import static org.junit.Assert.*; |
|
|
|
public class MergedContextConfigurationTests { |
|
|
|
public class MergedContextConfigurationTests { |
|
|
|
|
|
|
|
|
|
|
|
private static final String[] EMPTY_STRING_ARRAY = new String[0]; |
|
|
|
private static final String[] EMPTY_STRING_ARRAY = new String[0]; |
|
|
|
|
|
|
|
|
|
|
|
private static final Class<?>[] EMPTY_CLASS_ARRAY = new Class<?>[0]; |
|
|
|
private static final Class<?>[] EMPTY_CLASS_ARRAY = new Class<?>[0]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final GenericXmlContextLoader loader = new GenericXmlContextLoader(); |
|
|
|
private final GenericXmlContextLoader loader = new GenericXmlContextLoader(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -50,7 +52,6 @@ public class MergedContextConfigurationTests { |
|
|
|
public void hashCodeWithNulls() { |
|
|
|
public void hashCodeWithNulls() { |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(null, null, null, null, null); |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(null, null, null, null, null); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(null, null, null, null, null); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(null, null, null, null, null); |
|
|
|
assertTrue(mergedConfig1.hashCode() > 0); |
|
|
|
|
|
|
|
assertEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
assertEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -63,19 +64,19 @@ public class MergedContextConfigurationTests { |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void hashCodeWithEmptyArrays() { |
|
|
|
public void hashCodeWithEmptyArrays() { |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
assertEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
assertEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void hashCodeWithEmptyArraysAndDifferentLoaders() { |
|
|
|
public void hashCodeWithEmptyArraysAndDifferentLoaders() { |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, new AnnotationConfigContextLoader()); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, new AnnotationConfigContextLoader()); |
|
|
|
assertNotEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
assertNotEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -83,9 +84,9 @@ public class MergedContextConfigurationTests { |
|
|
|
public void hashCodeWithSameLocations() { |
|
|
|
public void hashCodeWithSameLocations() { |
|
|
|
String[] locations = new String[] { "foo", "bar}" }; |
|
|
|
String[] locations = new String[] { "foo", "bar}" }; |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), locations, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), locations, |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), locations, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), locations, |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
assertEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
assertEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -94,19 +95,19 @@ public class MergedContextConfigurationTests { |
|
|
|
String[] locations1 = new String[] { "foo", "bar}" }; |
|
|
|
String[] locations1 = new String[] { "foo", "bar}" }; |
|
|
|
String[] locations2 = new String[] { "baz", "quux}" }; |
|
|
|
String[] locations2 = new String[] { "baz", "quux}" }; |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), locations1, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), locations1, |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), locations2, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), locations2, |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
assertNotEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
assertNotEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void hashCodeWithSameConfigClasses() { |
|
|
|
public void hashCodeWithSameConfigClasses() { |
|
|
|
Class<?>[] classes = new Class<?>[] { String.class, Integer.class }; |
|
|
|
Class<?>[] classes = new Class<?>[] { String.class, Integer.class }; |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), |
|
|
|
classes, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_STRING_ARRAY, classes, EMPTY_STRING_ARRAY, loader); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), |
|
|
|
classes, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_STRING_ARRAY, classes, EMPTY_STRING_ARRAY, loader); |
|
|
|
assertEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
assertEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -114,20 +115,20 @@ public class MergedContextConfigurationTests { |
|
|
|
public void hashCodeWithDifferentConfigClasses() { |
|
|
|
public void hashCodeWithDifferentConfigClasses() { |
|
|
|
Class<?>[] classes1 = new Class<?>[] { String.class, Integer.class }; |
|
|
|
Class<?>[] classes1 = new Class<?>[] { String.class, Integer.class }; |
|
|
|
Class<?>[] classes2 = new Class<?>[] { Boolean.class, Number.class }; |
|
|
|
Class<?>[] classes2 = new Class<?>[] { Boolean.class, Number.class }; |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), |
|
|
|
classes1, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_STRING_ARRAY, classes1, EMPTY_STRING_ARRAY, loader); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), |
|
|
|
classes2, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_STRING_ARRAY, classes2, EMPTY_STRING_ARRAY, loader); |
|
|
|
assertNotEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
assertNotEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void hashCodeWithSameProfiles() { |
|
|
|
public void hashCodeWithSameProfiles() { |
|
|
|
String[] activeProfiles = new String[] { "catbert", "dogbert" }; |
|
|
|
String[] activeProfiles = new String[] { "catbert", "dogbert" }; |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, activeProfiles, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles, loader); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, activeProfiles, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles, loader); |
|
|
|
assertEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
assertEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -135,10 +136,10 @@ public class MergedContextConfigurationTests { |
|
|
|
public void hashCodeWithSameProfilesReversed() { |
|
|
|
public void hashCodeWithSameProfilesReversed() { |
|
|
|
String[] activeProfiles1 = new String[] { "catbert", "dogbert" }; |
|
|
|
String[] activeProfiles1 = new String[] { "catbert", "dogbert" }; |
|
|
|
String[] activeProfiles2 = new String[] { "dogbert", "catbert" }; |
|
|
|
String[] activeProfiles2 = new String[] { "dogbert", "catbert" }; |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, activeProfiles1, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles1, loader); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, activeProfiles2, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles2, loader); |
|
|
|
assertEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
assertEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -146,10 +147,10 @@ public class MergedContextConfigurationTests { |
|
|
|
public void hashCodeWithSameDuplicateProfiles() { |
|
|
|
public void hashCodeWithSameDuplicateProfiles() { |
|
|
|
String[] activeProfiles1 = new String[] { "catbert", "dogbert" }; |
|
|
|
String[] activeProfiles1 = new String[] { "catbert", "dogbert" }; |
|
|
|
String[] activeProfiles2 = new String[] { "catbert", "dogbert", "catbert", "dogbert", "catbert" }; |
|
|
|
String[] activeProfiles2 = new String[] { "catbert", "dogbert", "catbert", "dogbert", "catbert" }; |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, activeProfiles1, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles1, loader); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, activeProfiles2, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles2, loader); |
|
|
|
assertEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
assertEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -157,46 +158,46 @@ public class MergedContextConfigurationTests { |
|
|
|
public void hashCodeWithDifferentProfiles() { |
|
|
|
public void hashCodeWithDifferentProfiles() { |
|
|
|
String[] activeProfiles1 = new String[] { "catbert", "dogbert" }; |
|
|
|
String[] activeProfiles1 = new String[] { "catbert", "dogbert" }; |
|
|
|
String[] activeProfiles2 = new String[] { "X", "Y" }; |
|
|
|
String[] activeProfiles2 = new String[] { "X", "Y" }; |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, activeProfiles1, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles1, loader); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, activeProfiles2, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles2, loader); |
|
|
|
assertNotEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
assertNotEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void hashCodeWithSameInitializers() { |
|
|
|
public void hashCodeWithSameInitializers() { |
|
|
|
Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses1 = //
|
|
|
|
Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses1 = |
|
|
|
new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>(); |
|
|
|
new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>(); |
|
|
|
initializerClasses1.add(FooInitializer.class); |
|
|
|
initializerClasses1.add(FooInitializer.class); |
|
|
|
initializerClasses1.add(BarInitializer.class); |
|
|
|
initializerClasses1.add(BarInitializer.class); |
|
|
|
|
|
|
|
|
|
|
|
Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses2 = //
|
|
|
|
Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses2 = |
|
|
|
new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>(); |
|
|
|
new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>(); |
|
|
|
initializerClasses2.add(BarInitializer.class); |
|
|
|
initializerClasses2.add(BarInitializer.class); |
|
|
|
initializerClasses2.add(FooInitializer.class); |
|
|
|
initializerClasses2.add(FooInitializer.class); |
|
|
|
|
|
|
|
|
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, initializerClasses1, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, initializerClasses1, EMPTY_STRING_ARRAY, loader); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, initializerClasses2, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, initializerClasses2, EMPTY_STRING_ARRAY, loader); |
|
|
|
assertEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
assertEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void hashCodeWithDifferentInitializers() { |
|
|
|
public void hashCodeWithDifferentInitializers() { |
|
|
|
Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses1 = //
|
|
|
|
Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses1 = |
|
|
|
new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>(); |
|
|
|
new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>(); |
|
|
|
initializerClasses1.add(FooInitializer.class); |
|
|
|
initializerClasses1.add(FooInitializer.class); |
|
|
|
|
|
|
|
|
|
|
|
Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses2 = //
|
|
|
|
Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses2 = |
|
|
|
new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>(); |
|
|
|
new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>(); |
|
|
|
initializerClasses2.add(BarInitializer.class); |
|
|
|
initializerClasses2.add(BarInitializer.class); |
|
|
|
|
|
|
|
|
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, initializerClasses1, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, initializerClasses1, EMPTY_STRING_ARRAY, loader); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, initializerClasses2, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, initializerClasses2, EMPTY_STRING_ARRAY, loader); |
|
|
|
assertNotEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
assertNotEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -206,12 +207,12 @@ public class MergedContextConfigurationTests { |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void hashCodeWithSameParent() { |
|
|
|
public void hashCodeWithSameParent() { |
|
|
|
MergedContextConfiguration parent = new MergedContextConfiguration(getClass(), new String[] { "foo", "bar}" }, |
|
|
|
MergedContextConfiguration parent = new MergedContextConfiguration(getClass(), new String[] { "foo", "bar}" }, |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
|
|
|
|
|
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, null, EMPTY_STRING_ARRAY, loader, null, parent); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, null, EMPTY_STRING_ARRAY, loader, null, parent); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
EMPTY_CLASS_ARRAY, null, EMPTY_STRING_ARRAY, loader, null, parent); |
|
|
|
EMPTY_CLASS_ARRAY, null, EMPTY_STRING_ARRAY, loader, null, parent); |
|
|
|
assertEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
assertEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -221,14 +222,14 @@ public class MergedContextConfigurationTests { |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void hashCodeWithDifferentParents() { |
|
|
|
public void hashCodeWithDifferentParents() { |
|
|
|
MergedContextConfiguration parent1 = new MergedContextConfiguration(getClass(), new String[] { "foo", "bar}" }, |
|
|
|
MergedContextConfiguration parent1 = new MergedContextConfiguration(getClass(), new String[] { "foo", "bar}" }, |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
MergedContextConfiguration parent2 = new MergedContextConfiguration(getClass(), new String[] { "baz", "quux" }, |
|
|
|
MergedContextConfiguration parent2 = new MergedContextConfiguration(getClass(), new String[] { "baz", "quux" }, |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
|
|
|
|
|
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
EMPTY_CLASS_ARRAY, null, EMPTY_STRING_ARRAY, loader, null, parent1); |
|
|
|
EMPTY_CLASS_ARRAY, null, EMPTY_STRING_ARRAY, loader, null, parent1); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
EMPTY_CLASS_ARRAY, null, EMPTY_STRING_ARRAY, loader, null, parent2); |
|
|
|
EMPTY_CLASS_ARRAY, null, EMPTY_STRING_ARRAY, loader, null, parent2); |
|
|
|
assertNotEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
assertNotEquals(mergedConfig1.hashCode(), mergedConfig2.hashCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -237,7 +238,7 @@ public class MergedContextConfigurationTests { |
|
|
|
MergedContextConfiguration mergedConfig = new MergedContextConfiguration(null, null, null, null, null); |
|
|
|
MergedContextConfiguration mergedConfig = new MergedContextConfiguration(null, null, null, null, null); |
|
|
|
assertEquals(mergedConfig, mergedConfig); |
|
|
|
assertEquals(mergedConfig, mergedConfig); |
|
|
|
assertNotEquals(mergedConfig, null); |
|
|
|
assertNotEquals(mergedConfig, null); |
|
|
|
assertNotEquals(mergedConfig, new Integer(1)); |
|
|
|
assertNotEquals(mergedConfig, 1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
@ -256,19 +257,19 @@ public class MergedContextConfigurationTests { |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void equalsWithEmptyArrays() { |
|
|
|
public void equalsWithEmptyArrays() { |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
assertEquals(mergedConfig1, mergedConfig2); |
|
|
|
assertEquals(mergedConfig1, mergedConfig2); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void equalsWithEmptyArraysAndDifferentLoaders() { |
|
|
|
public void equalsWithEmptyArraysAndDifferentLoaders() { |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, new AnnotationConfigContextLoader()); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, new AnnotationConfigContextLoader()); |
|
|
|
assertNotEquals(mergedConfig1, mergedConfig2); |
|
|
|
assertNotEquals(mergedConfig1, mergedConfig2); |
|
|
|
assertNotEquals(mergedConfig2, mergedConfig1); |
|
|
|
assertNotEquals(mergedConfig2, mergedConfig1); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -276,10 +277,10 @@ public class MergedContextConfigurationTests { |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void equalsWithSameLocations() { |
|
|
|
public void equalsWithSameLocations() { |
|
|
|
String[] locations = new String[] { "foo", "bar}" }; |
|
|
|
String[] locations = new String[] { "foo", "bar}" }; |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), locations, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
locations, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), locations, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
locations, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
assertEquals(mergedConfig1, mergedConfig2); |
|
|
|
assertEquals(mergedConfig1, mergedConfig2); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -287,10 +288,10 @@ public class MergedContextConfigurationTests { |
|
|
|
public void equalsWithDifferentLocations() { |
|
|
|
public void equalsWithDifferentLocations() { |
|
|
|
String[] locations1 = new String[] { "foo", "bar}" }; |
|
|
|
String[] locations1 = new String[] { "foo", "bar}" }; |
|
|
|
String[] locations2 = new String[] { "baz", "quux}" }; |
|
|
|
String[] locations2 = new String[] { "baz", "quux}" }; |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), locations1, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
locations1, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), locations2, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
locations2, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); |
|
|
|
assertNotEquals(mergedConfig1, mergedConfig2); |
|
|
|
assertNotEquals(mergedConfig1, mergedConfig2); |
|
|
|
assertNotEquals(mergedConfig2, mergedConfig1); |
|
|
|
assertNotEquals(mergedConfig2, mergedConfig1); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -298,10 +299,10 @@ public class MergedContextConfigurationTests { |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void equalsWithSameConfigClasses() { |
|
|
|
public void equalsWithSameConfigClasses() { |
|
|
|
Class<?>[] classes = new Class<?>[] { String.class, Integer.class }; |
|
|
|
Class<?>[] classes = new Class<?>[] { String.class, Integer.class }; |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), |
|
|
|
classes, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_STRING_ARRAY, classes, EMPTY_STRING_ARRAY, loader); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), |
|
|
|
classes, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_STRING_ARRAY, classes, EMPTY_STRING_ARRAY, loader); |
|
|
|
assertEquals(mergedConfig1, mergedConfig2); |
|
|
|
assertEquals(mergedConfig1, mergedConfig2); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -309,10 +310,10 @@ public class MergedContextConfigurationTests { |
|
|
|
public void equalsWithDifferentConfigClasses() { |
|
|
|
public void equalsWithDifferentConfigClasses() { |
|
|
|
Class<?>[] classes1 = new Class<?>[] { String.class, Integer.class }; |
|
|
|
Class<?>[] classes1 = new Class<?>[] { String.class, Integer.class }; |
|
|
|
Class<?>[] classes2 = new Class<?>[] { Boolean.class, Number.class }; |
|
|
|
Class<?>[] classes2 = new Class<?>[] { Boolean.class, Number.class }; |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), |
|
|
|
classes1, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_STRING_ARRAY, classes1, EMPTY_STRING_ARRAY, loader); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), |
|
|
|
classes2, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_STRING_ARRAY, classes2, EMPTY_STRING_ARRAY, loader); |
|
|
|
assertNotEquals(mergedConfig1, mergedConfig2); |
|
|
|
assertNotEquals(mergedConfig1, mergedConfig2); |
|
|
|
assertNotEquals(mergedConfig2, mergedConfig1); |
|
|
|
assertNotEquals(mergedConfig2, mergedConfig1); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -320,10 +321,10 @@ public class MergedContextConfigurationTests { |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void equalsWithSameProfiles() { |
|
|
|
public void equalsWithSameProfiles() { |
|
|
|
String[] activeProfiles = new String[] { "catbert", "dogbert" }; |
|
|
|
String[] activeProfiles = new String[] { "catbert", "dogbert" }; |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, activeProfiles, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles, loader); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, activeProfiles, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles, loader); |
|
|
|
assertEquals(mergedConfig1, mergedConfig2); |
|
|
|
assertEquals(mergedConfig1, mergedConfig2); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -331,10 +332,10 @@ public class MergedContextConfigurationTests { |
|
|
|
public void equalsWithSameProfilesReversed() { |
|
|
|
public void equalsWithSameProfilesReversed() { |
|
|
|
String[] activeProfiles1 = new String[] { "catbert", "dogbert" }; |
|
|
|
String[] activeProfiles1 = new String[] { "catbert", "dogbert" }; |
|
|
|
String[] activeProfiles2 = new String[] { "dogbert", "catbert" }; |
|
|
|
String[] activeProfiles2 = new String[] { "dogbert", "catbert" }; |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, activeProfiles1, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles1, loader); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, activeProfiles2, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles2, loader); |
|
|
|
assertEquals(mergedConfig1, mergedConfig2); |
|
|
|
assertEquals(mergedConfig1, mergedConfig2); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -342,10 +343,10 @@ public class MergedContextConfigurationTests { |
|
|
|
public void equalsWithSameDuplicateProfiles() { |
|
|
|
public void equalsWithSameDuplicateProfiles() { |
|
|
|
String[] activeProfiles1 = new String[] { "catbert", "dogbert" }; |
|
|
|
String[] activeProfiles1 = new String[] { "catbert", "dogbert" }; |
|
|
|
String[] activeProfiles2 = new String[] { "catbert", "dogbert", "catbert", "dogbert", "catbert" }; |
|
|
|
String[] activeProfiles2 = new String[] { "catbert", "dogbert", "catbert", "dogbert", "catbert" }; |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, activeProfiles1, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles1, loader); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, activeProfiles2, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles2, loader); |
|
|
|
assertEquals(mergedConfig1, mergedConfig2); |
|
|
|
assertEquals(mergedConfig1, mergedConfig2); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -353,47 +354,47 @@ public class MergedContextConfigurationTests { |
|
|
|
public void equalsWithDifferentProfiles() { |
|
|
|
public void equalsWithDifferentProfiles() { |
|
|
|
String[] activeProfiles1 = new String[] { "catbert", "dogbert" }; |
|
|
|
String[] activeProfiles1 = new String[] { "catbert", "dogbert" }; |
|
|
|
String[] activeProfiles2 = new String[] { "X", "Y" }; |
|
|
|
String[] activeProfiles2 = new String[] { "X", "Y" }; |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, activeProfiles1, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles1, loader); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, activeProfiles2, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles2, loader); |
|
|
|
assertNotEquals(mergedConfig1, mergedConfig2); |
|
|
|
assertNotEquals(mergedConfig1, mergedConfig2); |
|
|
|
assertNotEquals(mergedConfig2, mergedConfig1); |
|
|
|
assertNotEquals(mergedConfig2, mergedConfig1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void equalsWithSameInitializers() { |
|
|
|
public void equalsWithSameInitializers() { |
|
|
|
Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses1 = //
|
|
|
|
Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses1 = |
|
|
|
new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>(); |
|
|
|
new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>(); |
|
|
|
initializerClasses1.add(FooInitializer.class); |
|
|
|
initializerClasses1.add(FooInitializer.class); |
|
|
|
initializerClasses1.add(BarInitializer.class); |
|
|
|
initializerClasses1.add(BarInitializer.class); |
|
|
|
|
|
|
|
|
|
|
|
Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses2 = //
|
|
|
|
Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses2 = |
|
|
|
new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>(); |
|
|
|
new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>(); |
|
|
|
initializerClasses2.add(BarInitializer.class); |
|
|
|
initializerClasses2.add(BarInitializer.class); |
|
|
|
initializerClasses2.add(FooInitializer.class); |
|
|
|
initializerClasses2.add(FooInitializer.class); |
|
|
|
|
|
|
|
|
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, initializerClasses1, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, initializerClasses1, EMPTY_STRING_ARRAY, loader); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, initializerClasses2, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, initializerClasses2, EMPTY_STRING_ARRAY, loader); |
|
|
|
assertEquals(mergedConfig1, mergedConfig2); |
|
|
|
assertEquals(mergedConfig1, mergedConfig2); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void equalsWithDifferentInitializers() { |
|
|
|
public void equalsWithDifferentInitializers() { |
|
|
|
Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses1 = //
|
|
|
|
Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses1 = |
|
|
|
new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>(); |
|
|
|
new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>(); |
|
|
|
initializerClasses1.add(FooInitializer.class); |
|
|
|
initializerClasses1.add(FooInitializer.class); |
|
|
|
|
|
|
|
|
|
|
|
Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses2 = //
|
|
|
|
Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses2 = |
|
|
|
new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>(); |
|
|
|
new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>(); |
|
|
|
initializerClasses2.add(BarInitializer.class); |
|
|
|
initializerClasses2.add(BarInitializer.class); |
|
|
|
|
|
|
|
|
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, initializerClasses1, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, initializerClasses1, EMPTY_STRING_ARRAY, loader); |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, |
|
|
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), |
|
|
|
EMPTY_CLASS_ARRAY, initializerClasses2, EMPTY_STRING_ARRAY, loader); |
|
|
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, initializerClasses2, EMPTY_STRING_ARRAY, loader); |
|
|
|
assertNotEquals(mergedConfig1, mergedConfig2); |
|
|
|
assertNotEquals(mergedConfig1, mergedConfig2); |
|
|
|
assertNotEquals(mergedConfig2, mergedConfig1); |
|
|
|
assertNotEquals(mergedConfig2, mergedConfig1); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -440,6 +441,7 @@ public class MergedContextConfigurationTests { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static class BarInitializer implements ApplicationContextInitializer<GenericApplicationContext> { |
|
|
|
private static class BarInitializer implements ApplicationContextInitializer<GenericApplicationContext> { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
|