Polishing
This commit is contained in:
parent
b2a17ba537
commit
26bbb6e767
|
|
@ -31,8 +31,8 @@ import org.apache.commons.logging.LogFactory;
|
|||
|
||||
import org.springframework.beans.BeanInstantiationException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.core.io.support.SpringFactoriesLoader;
|
||||
import org.springframework.test.context.BootstrapContext;
|
||||
import org.springframework.test.context.CacheAwareContextLoaderDelegate;
|
||||
|
|
@ -278,7 +278,7 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
|
|||
return buildDefaultMergedContextConfiguration(testClass, cacheAwareContextLoaderDelegate);
|
||||
}
|
||||
|
||||
if (AnnotatedElementUtils.findMergedAnnotation(testClass, ContextHierarchy.class) != null) {
|
||||
if (AnnotationUtils.findAnnotation(testClass, ContextHierarchy.class) != null) {
|
||||
Map<String, List<ContextConfigurationAttributes>> hierarchyMap = ContextLoaderUtils.buildContextHierarchyMap(testClass);
|
||||
MergedContextConfiguration parentConfig = null;
|
||||
MergedContextConfiguration mergedConfig = null;
|
||||
|
|
|
|||
|
|
@ -81,13 +81,12 @@ abstract class ContextLoaderUtils {
|
|||
* (must not be {@code null})
|
||||
* @return the list of lists of configuration attributes for the specified class;
|
||||
* never {@code null}
|
||||
* @throws IllegalArgumentException if the supplied class is {@code null}; if
|
||||
* @throws IllegalArgumentException if the supplied class is {@code null}; or if
|
||||
* neither {@code @ContextConfiguration} nor {@code @ContextHierarchy} is
|
||||
* <em>present</em> on the supplied class; or if a test class or composed annotation
|
||||
* <em>present</em> on the supplied class
|
||||
* @throws IllegalStateException if a test class or composed annotation
|
||||
* in the class hierarchy declares both {@code @ContextConfiguration} and
|
||||
* {@code @ContextHierarchy} as top-level annotations.
|
||||
* @throws IllegalStateException if no class in the class hierarchy declares
|
||||
* {@code @ContextHierarchy}.
|
||||
* @since 3.2.2
|
||||
* @see #buildContextHierarchyMap(Class)
|
||||
* @see #resolveContextConfigurationAttributes(Class)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -22,7 +22,6 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.ApplicationContextInitializer;
|
||||
|
|
@ -60,10 +59,13 @@ public class ContextLoaderUtilsContextHierarchyTests extends AbstractContextConf
|
|||
resolveContextHierarchyAttributes(SingleTestClassWithContextConfigurationAndContextHierarchyOnSingleMetaAnnotation.class);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
@Ignore // an upfront findAnnotation check just for an assertion seems too expensive
|
||||
@Test
|
||||
public void resolveContextHierarchyAttributesForSingleTestClassWithImplicitSingleLevelContextHierarchy() {
|
||||
resolveContextHierarchyAttributes(BareAnnotations.class);
|
||||
List<List<ContextConfigurationAttributes>> hierarchyAttributes = resolveContextHierarchyAttributes(BareAnnotations.class);
|
||||
assertEquals(1, hierarchyAttributes.size());
|
||||
List<ContextConfigurationAttributes> configAttributesList = hierarchyAttributes.get(0);
|
||||
assertEquals(1, configAttributesList.size());
|
||||
debugConfigAttributes(configAttributesList);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
Loading…
Reference in New Issue