Introduce MockEnvironment in the spring-test module

For legacy reasons, a MockEnvironment implementation already exists in multiple places within Spring's test suite; however, it is not available to the general public.

This commit promotes MockEnvironment to a first-class citizen in the spring-test module, alongside the existing MockPropertySource.

In addition, the following house cleaning has been performed.

 - deleted MockPropertySource from the spring-expression module
 - deleted MockEnvironment from the "spring" integration testing module
 - updated test copies of MockPropertySource and MockEnvironment
 - documented MockEnvironment and MockPropertySource in the testing
   chapter of the reference manual

Issue: SPR-9492
This commit is contained in:
Sam Brannen
2012-07-28 20:10:21 +02:00
parent 0329df218e
commit f49b22c78f
9 changed files with 72 additions and 143 deletions

View File

@@ -47,6 +47,22 @@
<section xml:id="mock-objects">
<title>Mock Objects</title>
<section xml:id="mock-objects-env">
<title>Environment</title>
<para>The <literal>org.springframework.mock.env</literal> package
contains mock implementations of the
<interfacename>Environment</interfacename> and
<interfacename>PropertySource</interfacename> abstractions introduced
in Spring 3.1 (see <xref
linkend="new-in-3.1-environment-abstraction" /> and <xref
linkend="new-in-3.1-property-source-abstraction" />).
<classname>MockEnvironment</classname> and
<classname>MockPropertySource</classname> are useful for developing
<emphasis>out-of-container</emphasis> unit tests for code that depends
on environment-specific properties.</para>
</section>
<section xml:id="mock-objects-jndi">
<title>JNDI</title>