public class MergedContextConfiguration extends Object implements Serializable
MergedContextConfiguration
encapsulates the merged
context configuration declared on a test class and all of its superclasses
via @ContextConfiguration
and
@ActiveProfiles
.
Merged resource locations, configuration classes, and active profiles
represent all declared values in the test class hierarchy taking into
consideration the semantics of the
inheritLocations
and
inheritProfiles
flags in
@ContextConfiguration
and @ActiveProfiles
, respectively.
A SmartContextLoader
uses MergedContextConfiguration
to load an ApplicationContext
.
MergedContextConfiguration
is also used by the TestContext
as the context cache key for caching an
ApplicationContext
that was loaded using properties of this MergedContextConfiguration
.
ContextConfiguration
,
ActiveProfiles
,
ContextConfigurationAttributes
,
SmartContextLoader.loadContext(MergedContextConfiguration)
,
Serialized FormConstructor and Description |
---|
MergedContextConfiguration(Class<?> testClass,
String[] locations,
Class<?>[] classes,
String[] activeProfiles,
ContextLoader contextLoader)
Create a new
MergedContextConfiguration instance for the
supplied test class , resource locations, configuration
classes, active profiles, and ContextLoader . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Determine if the supplied object is equal to this
MergedContextConfiguration
instance by comparing both object's locations ,
configuration classes , active profiles , and the fully qualified names of their
ContextLoaders . |
String[] |
getActiveProfiles()
Get the merged active bean definition profiles for the
test class . |
Class<?>[] |
getClasses()
Get the merged configuration classes for the
test class . |
ContextLoader |
getContextLoader()
Get the resolved
ContextLoader for the
test class . |
String[] |
getLocations()
Get the merged resource locations for the
test class . |
Class<?> |
getTestClass()
Get the
test class associated with this
MergedContextConfiguration . |
int |
hashCode()
Generate a unique hash code for all properties of this
MergedContextConfiguration excluding the
test class . |
String |
toString()
Provide a String representation of the
test class ,
locations , configuration classes ,
active profiles , and the name of the
ContextLoader . |
public MergedContextConfiguration(Class<?> testClass, String[] locations, Class<?>[] classes, String[] activeProfiles, ContextLoader contextLoader)
MergedContextConfiguration
instance for the
supplied test class
, resource locations, configuration
classes, active profiles, and ContextLoader
.
If a null
value is supplied for locations
,
classes
, or activeProfiles
an empty array will
be stored instead. Furthermore, active profiles will be sorted, and duplicate
profiles will be removed.
testClass
- the test class for which the configuration was mergedlocations
- the merged resource locationsclasses
- the merged configuration classesactiveProfiles
- the merged active bean definition profilescontextLoader
- the resolved ContextLoader
public Class<?> getTestClass()
test class
associated with this
MergedContextConfiguration
.public String[] getLocations()
test class
.public Class<?>[] getClasses()
test class
.public String[] getActiveProfiles()
test class
.public ContextLoader getContextLoader()
ContextLoader
for the
test class
.public int hashCode()
MergedContextConfiguration
excluding the
test class
.public boolean equals(Object obj)
MergedContextConfiguration
instance by comparing both object's locations
,
configuration classes
, active profiles
, and the fully qualified names of their
ContextLoaders
.public String toString()
test class
,
locations
, configuration classes
,
active profiles
, and the name of the
ContextLoader
.Copyright © 2015. All rights reserved.