File tree Expand file tree Collapse file tree 3 files changed +12
-11
lines changed
main/java/org/springframework/test/context/support
test/java/org/springframework/test/context/support Expand file tree Collapse file tree 3 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 31
31
32
32
import org .springframework .beans .BeanInstantiationException ;
33
33
import org .springframework .beans .BeanUtils ;
34
- import org .springframework .core .annotation .AnnotatedElementUtils ;
35
34
import org .springframework .core .annotation .AnnotationAwareOrderComparator ;
35
+ import org .springframework .core .annotation .AnnotationUtils ;
36
36
import org .springframework .core .io .support .SpringFactoriesLoader ;
37
37
import org .springframework .test .context .BootstrapContext ;
38
38
import org .springframework .test .context .CacheAwareContextLoaderDelegate ;
@@ -278,7 +278,7 @@ public final MergedContextConfiguration buildMergedContextConfiguration() {
278
278
return buildDefaultMergedContextConfiguration (testClass , cacheAwareContextLoaderDelegate );
279
279
}
280
280
281
- if (AnnotatedElementUtils . findMergedAnnotation (testClass , ContextHierarchy .class ) != null ) {
281
+ if (AnnotationUtils . findAnnotation (testClass , ContextHierarchy .class ) != null ) {
282
282
Map <String , List <ContextConfigurationAttributes >> hierarchyMap = ContextLoaderUtils .buildContextHierarchyMap (testClass );
283
283
MergedContextConfiguration parentConfig = null ;
284
284
MergedContextConfiguration mergedConfig = null ;
Original file line number Diff line number Diff line change @@ -81,13 +81,12 @@ abstract class ContextLoaderUtils {
81
81
* (must not be {@code null})
82
82
* @return the list of lists of configuration attributes for the specified class;
83
83
* never {@code null}
84
- * @throws IllegalArgumentException if the supplied class is {@code null}; if
84
+ * @throws IllegalArgumentException if the supplied class is {@code null}; or if
85
85
* neither {@code @ContextConfiguration} nor {@code @ContextHierarchy} is
86
- * <em>present</em> on the supplied class; or if a test class or composed annotation
86
+ * <em>present</em> on the supplied class
87
+ * @throws IllegalStateException if a test class or composed annotation
87
88
* in the class hierarchy declares both {@code @ContextConfiguration} and
88
89
* {@code @ContextHierarchy} as top-level annotations.
89
- * @throws IllegalStateException if no class in the class hierarchy declares
90
- * {@code @ContextHierarchy}.
91
90
* @since 3.2.2
92
91
* @see #buildContextHierarchyMap(Class)
93
92
* @see #resolveContextConfigurationAttributes(Class)
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2014 the original author or authors.
2
+ * Copyright 2002-2016 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
22
22
import java .util .List ;
23
23
import java .util .Map ;
24
24
25
- import org .junit .Ignore ;
26
25
import org .junit .Test ;
27
26
28
27
import org .springframework .context .ApplicationContextInitializer ;
@@ -60,10 +59,13 @@ public void resolveContextHierarchyAttributesForSingleTestClassWithContextConfig
60
59
resolveContextHierarchyAttributes (SingleTestClassWithContextConfigurationAndContextHierarchyOnSingleMetaAnnotation .class );
61
60
}
62
61
63
- @ Test (expected = IllegalStateException .class )
64
- @ Ignore // an upfront findAnnotation check just for an assertion seems too expensive
62
+ @ Test
65
63
public void resolveContextHierarchyAttributesForSingleTestClassWithImplicitSingleLevelContextHierarchy () {
66
- resolveContextHierarchyAttributes (BareAnnotations .class );
64
+ List <List <ContextConfigurationAttributes >> hierarchyAttributes = resolveContextHierarchyAttributes (BareAnnotations .class );
65
+ assertEquals (1 , hierarchyAttributes .size ());
66
+ List <ContextConfigurationAttributes > configAttributesList = hierarchyAttributes .get (0 );
67
+ assertEquals (1 , configAttributesList .size ());
68
+ debugConfigAttributes (configAttributesList );
67
69
}
68
70
69
71
@ Test
You can’t perform that action at this time.
0 commit comments