Avoid duplicates in MergedContextConfiguration

Remove duplicate config attribute classes by using a `Set` rather
than a `List` in the `SpringBootTestContextBootstrapper`.

See gh-24532
This commit is contained in:
dreis2211
2020-12-16 19:48:03 +01:00
committed by Phillip Webb
parent 0e5df2296e
commit 0ec603cdad
2 changed files with 28 additions and 10 deletions

View File

@@ -134,7 +134,7 @@ public class SpringBootTestContextBootstrapper extends DefaultTestContextBootstr
}
private void addConfigAttributesClasses(ContextConfigurationAttributes configAttributes, Class<?>[] classes) {
List<Class<?>> combined = new ArrayList<>(Arrays.asList(classes));
Set<Class<?>> combined = new LinkedHashSet<>(Arrays.asList(classes));
if (configAttributes.getClasses() != null) {
combined.addAll(Arrays.asList(configAttributes.getClasses()));
}