org.springframework.test.context.web

## Class WebMergedContextConfiguration

- java.lang.Object
- - org.springframework.test.context.MergedContextConfiguration
  - - org.springframework.test.context.web.WebMergedContextConfiguration

All Implemented Interfaces:
  Serializable

    public class WebMergedContextConfiguration
    extends MergedContextConfiguration

`WebMergedContextConfiguration` encapsulates the merged context configuration declared on a test class and all of its superclasses via `@ContextConfiguration`, `@WebAppConfiguration`, and `@ActiveProfiles`.

`WebMergedContextConfiguration` extends the contract of `MergedContextConfiguration` by adding support for the `resource base path` configured via `@WebAppConfiguration`. This allows the `TestContext` to properly cache the corresponding `WebApplicationContext` that was loaded using properties of this `WebMergedContextConfiguration`.

Since:
  3.2
Author:
  Sam Brannen
See Also:
  `WebAppConfiguration`, `MergedContextConfiguration`, `ContextConfiguration`, `ActiveProfiles`, `ContextConfigurationAttributes`, `SmartContextLoader.loadContext(MergedContextConfiguration)`, Serialized Form

### Constructor Summary

Constructors
Constructor and Description

`WebMergedContextConfiguration(Class<?> testClass, String[] locations, Class<?>[] classes, Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> contextInitializerClasses, String[] activeProfiles, String resourceBasePath, ContextLoader contextLoader)`
Create a new `WebMergedContextConfiguration` instance for the supplied test class, resource locations, annotated classes, context initializers, active profiles, resource base path, and `ContextLoader`.

### Method Summary

Methods
`boolean` `equals(Object obj)` Determine if the supplied object is equal to this `WebMergedContextConfiguration` instance by comparing both object's locations, annotated classes, context initializer classes, active profiles, resource base path, and the fully qualified names of their `ContextLoaders`.
`String` `getResourceBasePath()` Get the resource path to the root directory of the web application for the test class, configured via `@WebAppConfiguration`.
`int` `hashCode()` Generate a unique hash code for all properties of this `WebMergedContextConfiguration` excluding the test class.
`String` `toString()` Provide a String representation of the test class, locations, annotated classes, context initializer classes, active profiles, resource base path, and the name of the `ContextLoader`.

### Methods inherited from class org.springframework.test.context.MergedContextConfiguration

`getActiveProfiles, getClasses, getContextInitializerClasses, getContextLoader, getLocations, getTestClass, nullSafeToString`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### WebMergedContextConfiguration

    public WebMergedContextConfiguration(Class<?> testClass,
                                 String[] locations,
                                 Class<?>[] classes,
                                 Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> contextInitializerClasses,
                                 String[] activeProfiles,
                                 String resourceBasePath,
                                 ContextLoader contextLoader)

Create a new `WebMergedContextConfiguration` instance for the supplied test class, resource locations, annotated classes, context initializers, active profiles, resource base path, and `ContextLoader`.

If a `null` value is supplied for `locations`, `classes`, or `activeProfiles` an empty array will be stored instead. If a `null` value is supplied for the `contextInitializerClasses` an empty set will be stored instead. If an empty value is supplied for the `resourceBasePath` an empty string will be used. Furthermore, active profiles will be sorted, and duplicate profiles will be removed.

Parameters:
  `testClass` - the test class for which the configuration was merged
  `locations` - the merged resource locations
  `classes` - the merged annotated classes
  `contextInitializerClasses` - the merged context initializer classes
  `activeProfiles` - the merged active bean definition profiles
  `resourceBasePath` - the resource path to the root directory of the web application
  `contextLoader` - the resolved `ContextLoader`

### Method Detail

#### getResourceBasePath

    public String getResourceBasePath()

Get the resource path to the root directory of the web application for the test class, configured via `@WebAppConfiguration`.

See Also:
  `WebAppConfiguration`

#### hashCode

    public int hashCode()

Generate a unique hash code for all properties of this `WebMergedContextConfiguration` excluding the test class.

Overrides:
  `hashCode` in class `MergedContextConfiguration`

#### equals

    public boolean equals(Object obj)

Determine if the supplied object is equal to this `WebMergedContextConfiguration` instance by comparing both object's locations, annotated classes, context initializer classes, active profiles, resource base path, and the fully qualified names of their `ContextLoaders`.

Overrides:
  `equals` in class `MergedContextConfiguration`

#### toString

    public String toString()

Provide a String representation of the test class, locations, annotated classes, context initializer classes, active profiles, resource base path, and the name of the `ContextLoader`.

Overrides:
  `toString` in class `MergedContextConfiguration`