Replace <code> with {@code} throughout Javadoc
Issue: SPR-10128
This commit is contained in:
@@ -16,8 +16,8 @@
|
||||
|
||||
/**
|
||||
* Mock implementations of client-side HTTP abstractions.
|
||||
* This package contains the <code>MockClientHttpRequest</code> and
|
||||
* <code>MockClientHttpResponse</code>.
|
||||
* This package contains the {@code MockClientHttpRequest} and
|
||||
* {@code MockClientHttpResponse}.
|
||||
*/
|
||||
package org.springframework.mock.http.client;
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
/**
|
||||
* Mock implementations of client/server-side HTTP abstractions.
|
||||
* This package contains <code>MockHttpInputMessage</code> and
|
||||
* <code>MockHttpOutputMessage</code>.
|
||||
* This package contains {@code MockHttpInputMessage} and
|
||||
* {@code MockHttpOutputMessage}.
|
||||
*/
|
||||
package org.springframework.mock.http;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ExpectedLookupTemplate extends JndiTemplate {
|
||||
|
||||
/**
|
||||
* Construct a new JndiTemplate that will always return given objects for
|
||||
* given names. To be populated through <code>addObject</code> calls.
|
||||
* given names. To be populated through {@code addObject} calls.
|
||||
* @see #addObject(String, Object)
|
||||
*/
|
||||
public ExpectedLookupTemplate() {
|
||||
|
||||
@@ -41,13 +41,13 @@ import org.springframework.util.StringUtils;
|
||||
* Mainly for test environments, but also usable for standalone applications.
|
||||
*
|
||||
* <p>This class is not intended for direct usage by applications, although it
|
||||
* can be used for example to override JndiTemplate's <code>createInitialContext</code>
|
||||
* can be used for example to override JndiTemplate's {@code createInitialContext}
|
||||
* method in unit tests. Typically, SimpleNamingContextBuilder will be used to
|
||||
* set up a JVM-level JNDI environment.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
* @see org.springframework.mock.jndi.SimpleNamingContextBuilder
|
||||
* @see SimpleNamingContextBuilder
|
||||
* @see org.springframework.jndi.JndiTemplate#createInitialContext
|
||||
*/
|
||||
public class SimpleNamingContext implements Context {
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.springframework.util.ClassUtils;
|
||||
* Simple implementation of a JNDI naming context builder.
|
||||
*
|
||||
* <p>Mainly targeted at test environments, where each test case can
|
||||
* configure JNDI appropriately, so that <code>new InitialContext()</code>
|
||||
* configure JNDI appropriately, so that {@code new InitialContext()}
|
||||
* will expose the required objects. Also usable for standalone applications,
|
||||
* e.g. for binding a JDBC DataSource to a well-known JNDI location, to be
|
||||
* able to use traditional J2EE data access code outside of a J2EE container.
|
||||
@@ -63,7 +63,7 @@ import org.springframework.util.ClassUtils;
|
||||
* DataSource ds = new DriverManagerDataSource(...);
|
||||
* builder.bind("java:comp/env/jdbc/myds", ds);</pre>
|
||||
*
|
||||
* Note that you <i>should not</i> call <code>activate()</code> on a builder from
|
||||
* Note that you <i>should not</i> call {@code activate()} on a builder from
|
||||
* this factory method, as there will already be an activated one in any case.
|
||||
*
|
||||
* <p>An instance of this class is only necessary at setup time.
|
||||
@@ -74,7 +74,7 @@ import org.springframework.util.ClassUtils;
|
||||
* @see #emptyActivatedContextBuilder()
|
||||
* @see #bind(String, Object)
|
||||
* @see #activate()
|
||||
* @see org.springframework.mock.jndi.SimpleNamingContext
|
||||
* @see SimpleNamingContext
|
||||
* @see org.springframework.jdbc.datasource.SingleConnectionDataSource
|
||||
* @see org.springframework.jdbc.datasource.DriverManagerDataSource
|
||||
* @see org.apache.commons.dbcp.BasicDataSource
|
||||
@@ -92,7 +92,7 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
|
||||
/**
|
||||
* Checks if a SimpleNamingContextBuilder is active.
|
||||
* @return the current SimpleNamingContextBuilder instance,
|
||||
* or <code>null</code> if none
|
||||
* or {@code null} if none
|
||||
*/
|
||||
public static SimpleNamingContextBuilder getCurrentContextBuilder() {
|
||||
return activated;
|
||||
@@ -129,8 +129,8 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
|
||||
|
||||
/**
|
||||
* Register the context builder by registering it with the JNDI NamingManager.
|
||||
* Note that once this has been done, <code>new InitialContext()</code> will always
|
||||
* return a context from this factory. Use the <code>emptyActivatedContextBuilder()</code>
|
||||
* Note that once this has been done, {@code new InitialContext()} will always
|
||||
* return a context from this factory. Use the {@code emptyActivatedContextBuilder()}
|
||||
* static method to get an empty context (for example, in test methods).
|
||||
* @throws IllegalStateException if there's already a naming context builder
|
||||
* registered with the JNDI NamingManager
|
||||
@@ -156,7 +156,7 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
|
||||
* Temporarily deactivate this context builder. It will remain registered with
|
||||
* the JNDI NamingManager but will delegate to the standard JNDI InitialContextFactory
|
||||
* (if configured) instead of exposing its own bound objects.
|
||||
* <p>Call <code>activate()</code> again in order to expose this context builder's own
|
||||
* <p>Call {@code activate()} again in order to expose this context builder's own
|
||||
* bound objects again. Such activate/deactivate sequences can be applied any number
|
||||
* of times (e.g. within a larger integration test suite running in the same VM).
|
||||
* @see #activate()
|
||||
|
||||
@@ -39,7 +39,7 @@ public class DelegatingServletInputStream extends ServletInputStream {
|
||||
|
||||
/**
|
||||
* Create a DelegatingServletInputStream for the given source stream.
|
||||
* @param sourceStream the source stream (never <code>null</code>)
|
||||
* @param sourceStream the source stream (never {@code null})
|
||||
*/
|
||||
public DelegatingServletInputStream(InputStream sourceStream) {
|
||||
Assert.notNull(sourceStream, "Source InputStream must not be null");
|
||||
@@ -47,7 +47,7 @@ public class DelegatingServletInputStream extends ServletInputStream {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the underlying source stream (never <code>null</code>).
|
||||
* Return the underlying source stream (never {@code null}).
|
||||
*/
|
||||
public final InputStream getSourceStream() {
|
||||
return this.sourceStream;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class DelegatingServletOutputStream extends ServletOutputStream {
|
||||
|
||||
/**
|
||||
* Create a DelegatingServletOutputStream for the given target stream.
|
||||
* @param targetStream the target stream (never <code>null</code>)
|
||||
* @param targetStream the target stream (never {@code null})
|
||||
*/
|
||||
public DelegatingServletOutputStream(OutputStream targetStream) {
|
||||
Assert.notNull(targetStream, "Target OutputStream must not be null");
|
||||
@@ -47,7 +47,7 @@ public class DelegatingServletOutputStream extends ServletOutputStream {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the underlying target stream (never <code>null</code>).
|
||||
* Return the underlying target stream (never {@code null}).
|
||||
*/
|
||||
public final OutputStream getTargetStream() {
|
||||
return this.targetStream;
|
||||
|
||||
@@ -81,7 +81,7 @@ class HeaderValueHolder {
|
||||
* @param headers the Map of header names to HeaderValueHolders
|
||||
* @param name the name of the desired header
|
||||
* @return the corresponding HeaderValueHolder,
|
||||
* or <code>null</code> if none found
|
||||
* or {@code null} if none found
|
||||
*/
|
||||
public static HeaderValueHolder getByName(Map<String, HeaderValueHolder> headers, String name) {
|
||||
Assert.notNull(name, "Header name must not be null");
|
||||
|
||||
@@ -52,7 +52,7 @@ import org.springframework.util.LinkedCaseInsensitiveMap;
|
||||
* Mock implementation of the {@link javax.servlet.http.HttpServletRequest} interface.
|
||||
*
|
||||
* <p>Compatible with Servlet 2.5 and partially with Servlet 3.0 (notable exceptions:
|
||||
* the <code>getPart(s)</code> and <code>startAsync</code> families of methods).
|
||||
* the {@code getPart(s)} and {@code startAsync} families of methods).
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Rod Johnson
|
||||
@@ -195,8 +195,8 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
/**
|
||||
* Create a new {@code MockHttpServletRequest} with a default
|
||||
* {@link MockServletContext}.
|
||||
* @param method the request method (may be <code>null</code>)
|
||||
* @param requestURI the request URI (may be <code>null</code>)
|
||||
* @param method the request method (may be {@code null})
|
||||
* @param requestURI the request URI (may be {@code null})
|
||||
* @see #setMethod
|
||||
* @see #setRequestURI
|
||||
* @see #MockHttpServletRequest(ServletContext, String, String)
|
||||
@@ -208,7 +208,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
/**
|
||||
* Create a new {@code MockHttpServletRequest} with the supplied {@link ServletContext}.
|
||||
* @param servletContext the ServletContext that the request runs in (may be
|
||||
* <code>null</code> to use a default {@link MockServletContext})
|
||||
* {@code null} to use a default {@link MockServletContext})
|
||||
* @see #MockHttpServletRequest(ServletContext, String, String)
|
||||
*/
|
||||
public MockHttpServletRequest(ServletContext servletContext) {
|
||||
@@ -220,9 +220,9 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
* {@code method}, and {@code requestURI}.
|
||||
* <p>The preferred locale will be set to {@link Locale#ENGLISH}.
|
||||
* @param servletContext the ServletContext that the request runs in (may be
|
||||
* <code>null</code> to use a default {@link MockServletContext})
|
||||
* @param method the request method (may be <code>null</code>)
|
||||
* @param requestURI the request URI (may be <code>null</code>)
|
||||
* {@code null} to use a default {@link MockServletContext})
|
||||
* @param method the request method (may be {@code null})
|
||||
* @param requestURI the request URI (may be {@code null})
|
||||
* @see #setMethod
|
||||
* @see #setRequestURI
|
||||
* @see #setPreferredLocales
|
||||
@@ -662,8 +662,8 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
* adding the given value (more specifically, its toString representation)
|
||||
* as further element.
|
||||
* <p>Multiple values can only be stored as list of Strings, following the
|
||||
* Servlet spec (see <code>getHeaders</code> accessor). As alternative to
|
||||
* repeated <code>addHeader</code> calls for individual elements, you can
|
||||
* Servlet spec (see {@code getHeaders} accessor). As alternative to
|
||||
* repeated {@code addHeader} calls for individual elements, you can
|
||||
* use a single call with an entire array or Collection of values as
|
||||
* parameter.
|
||||
* @see #getHeaderNames
|
||||
|
||||
@@ -108,7 +108,7 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
|
||||
/**
|
||||
* Set whether {@link #getOutputStream()} access is allowed.
|
||||
* <p>Default is <code>true</code>.
|
||||
* <p>Default is {@code true}.
|
||||
*/
|
||||
public void setOutputStreamAccessAllowed(boolean outputStreamAccessAllowed) {
|
||||
this.outputStreamAccessAllowed = outputStreamAccessAllowed;
|
||||
@@ -123,7 +123,7 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
|
||||
/**
|
||||
* Set whether {@link #getWriter()} access is allowed.
|
||||
* <p>Default is <code>true</code>.
|
||||
* <p>Default is {@code true}.
|
||||
*/
|
||||
public void setWriterAccessAllowed(boolean writerAccessAllowed) {
|
||||
this.writerAccessAllowed = writerAccessAllowed;
|
||||
@@ -297,7 +297,7 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
/**
|
||||
* Return the names of all specified headers as a Set of Strings.
|
||||
* <p>As of Servlet 3.0, this method is also defined HttpServletResponse.
|
||||
* @return the <code>Set</code> of header name <code>Strings</code>, or an empty <code>Set</code> if none
|
||||
* @return the {@code Set} of header name {@code Strings}, or an empty {@code Set} if none
|
||||
*/
|
||||
public Set<String> getHeaderNames() {
|
||||
return this.headers.keySet();
|
||||
@@ -310,7 +310,7 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
* As of Spring 3.1, it returns a stringified value for Servlet 3.0 compatibility.
|
||||
* Consider using {@link #getHeaderValue(String)} for raw Object access.
|
||||
* @param name the name of the header
|
||||
* @return the associated header value, or <code>null<code> if none
|
||||
* @return the associated header value, or {@code null} if none
|
||||
*/
|
||||
public String getHeader(String name) {
|
||||
HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name);
|
||||
@@ -339,7 +339,7 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
* Return the primary value for the given header, if any.
|
||||
* <p>Will return the first value in case of multiple values.
|
||||
* @param name the name of the header
|
||||
* @return the associated header value, or <code>null<code> if none
|
||||
* @return the associated header value, or {@code null} if none
|
||||
*/
|
||||
public Object getHeaderValue(String name) {
|
||||
HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name);
|
||||
|
||||
@@ -46,8 +46,8 @@ import org.springframework.util.Assert;
|
||||
* applications when testing custom JSP tags.
|
||||
*
|
||||
* <p>Note: Expects initialization via the constructor rather than via the
|
||||
* <code>PageContext.initialize</code> method. Does not support writing to
|
||||
* a JspWriter, request dispatching, and <code>handlePageException</code> calls.
|
||||
* {@code PageContext.initialize} method. Does not support writing to
|
||||
* a JspWriter, request dispatching, and {@code handlePageException} calls.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 1.0.2
|
||||
|
||||
@@ -46,7 +46,7 @@ import org.springframework.util.Assert;
|
||||
* which match named beans in the context. This is autowire by name, rather than
|
||||
* type. This approach is based on an approach originated by Ara Abrahmian.
|
||||
* Setter Dependency Injection is the default: set the
|
||||
* <code>populateProtectedVariables</code> property to <code>true</code> in
|
||||
* {@code populateProtectedVariables} property to {@code true} in
|
||||
* the constructor to switch on Field Injection.
|
||||
* </ul>
|
||||
*
|
||||
@@ -114,7 +114,7 @@ public abstract class AbstractDependencyInjectionSpringContextTests extends Abst
|
||||
|
||||
/**
|
||||
* Set whether to populate protected variables of this test case. Default is
|
||||
* <code>false</code>.
|
||||
* {@code false}.
|
||||
*/
|
||||
public final void setPopulateProtectedVariables(boolean populateFields) {
|
||||
this.populateProtectedVariables = populateFields;
|
||||
@@ -149,7 +149,7 @@ public abstract class AbstractDependencyInjectionSpringContextTests extends Abst
|
||||
/**
|
||||
* Set whether or not dependency checking should be performed for test
|
||||
* properties set by Dependency Injection.
|
||||
* <p>The default is <code>true</code>, meaning that tests cannot be run
|
||||
* <p>The default is {@code true}, meaning that tests cannot be run
|
||||
* unless all properties are populated.
|
||||
*/
|
||||
public final void setDependencyCheck(final boolean dependencyCheck) {
|
||||
@@ -168,7 +168,7 @@ public abstract class AbstractDependencyInjectionSpringContextTests extends Abst
|
||||
* Prepare this test instance, injecting dependencies into its protected
|
||||
* fields and its bean properties.
|
||||
* <p>Note: if the {@link ApplicationContext} for this test instance has not
|
||||
* been configured (e.g., is <code>null</code>), dependency injection
|
||||
* been configured (e.g., is {@code null}), dependency injection
|
||||
* will naturally <strong>not</strong> be performed, but an informational
|
||||
* message will be written to the log.
|
||||
* @see #injectDependencies()
|
||||
|
||||
@@ -92,7 +92,7 @@ public abstract class AbstractSingleSpringContextTests extends AbstractSpringCon
|
||||
}
|
||||
|
||||
/**
|
||||
* This implementation is final. Override <code>onSetUp</code> for custom behavior.
|
||||
* This implementation is final. Override {@code onSetUp} for custom behavior.
|
||||
* @see #onSetUp()
|
||||
*/
|
||||
protected final void setUp() throws Exception {
|
||||
@@ -114,7 +114,7 @@ public abstract class AbstractSingleSpringContextTests extends AbstractSpringCon
|
||||
}
|
||||
|
||||
/**
|
||||
* Subclasses can override this method in place of the <code>setUp()</code>
|
||||
* Subclasses can override this method in place of the {@code setUp()}
|
||||
* method, which is final in this class.
|
||||
* <p>The default implementation does nothing.
|
||||
* @throws Exception simply let any exception propagate
|
||||
@@ -132,7 +132,7 @@ public abstract class AbstractSingleSpringContextTests extends AbstractSpringCon
|
||||
}
|
||||
|
||||
/**
|
||||
* This implementation is final. Override <code>onTearDown</code> for
|
||||
* This implementation is final. Override {@code onTearDown} for
|
||||
* custom behavior.
|
||||
* @see #onTearDown()
|
||||
*/
|
||||
@@ -165,7 +165,7 @@ public abstract class AbstractSingleSpringContextTests extends AbstractSpringCon
|
||||
* context from the given locations.
|
||||
* <p>If you override {@link #contextKey()}, you will typically have to
|
||||
* override this method as well, being able to handle the key type that
|
||||
* <code>contextKey()</code> returns.
|
||||
* {@code contextKey()} returns.
|
||||
* @see #getConfigLocations()
|
||||
*/
|
||||
protected ConfigurableApplicationContext loadContext(Object key) throws Exception {
|
||||
@@ -198,7 +198,7 @@ public abstract class AbstractSingleSpringContextTests extends AbstractSpringCon
|
||||
* instance, calls the {@link #prepareApplicationContext} prepareApplicationContext}
|
||||
* method and the {@link #customizeBeanFactory customizeBeanFactory} method to allow
|
||||
* for customizing the context and its DefaultListableBeanFactory, populates the
|
||||
* context from the specified config <code>locations</code> through the configured
|
||||
* context from the specified config {@code locations} through the configured
|
||||
* {@link #createBeanDefinitionReader(GenericApplicationContext) BeanDefinitionReader},
|
||||
* and finally {@link ConfigurableApplicationContext#refresh() refreshes} the context.
|
||||
* @param locations the config locations (as Spring resource locations,
|
||||
@@ -321,10 +321,10 @@ public abstract class AbstractSingleSpringContextTests extends AbstractSpringCon
|
||||
* from the same package that the concrete test class is defined in. A path
|
||||
* starting with a slash is treated as fully qualified class path location,
|
||||
* e.g.: "/org/springframework/whatever/foo.xml".
|
||||
* <p>The default implementation simply returns <code>null</code>.
|
||||
* <p>The default implementation simply returns {@code null}.
|
||||
* @return an array of config locations
|
||||
* @see #getConfigPath()
|
||||
* @see java.lang.Class#getResource(String)
|
||||
* @see Class#getResource(String)
|
||||
*/
|
||||
protected String getConfigPath() {
|
||||
return null;
|
||||
@@ -332,7 +332,7 @@ public abstract class AbstractSingleSpringContextTests extends AbstractSpringCon
|
||||
|
||||
/**
|
||||
* Return the ApplicationContext that this base class manages; may be
|
||||
* <code>null</code>.
|
||||
* {@code null}.
|
||||
*/
|
||||
public final ConfigurableApplicationContext getApplicationContext() {
|
||||
// lazy load, in case setUp() has not yet been called.
|
||||
|
||||
@@ -106,11 +106,11 @@ public abstract class AbstractSpringContextTests extends ConditionalTestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the supplied context <code>key</code> is <em>empty</em>.
|
||||
* <p>By default, <code>null</code> values, empty strings, and zero-length
|
||||
* Determine if the supplied context {@code key} is <em>empty</em>.
|
||||
* <p>By default, {@code null} values, empty strings, and zero-length
|
||||
* arrays are considered <em>empty</em>.
|
||||
* @param key the context key to check
|
||||
* @return <code>true</code> if the supplied context key is empty
|
||||
* @return {@code true} if the supplied context key is empty
|
||||
*/
|
||||
protected boolean isContextKeyEmpty(Object key) {
|
||||
return (key == null) || ((key instanceof String) && !StringUtils.hasText((String) key)) ||
|
||||
@@ -119,9 +119,9 @@ public abstract class AbstractSpringContextTests extends ConditionalTestCase {
|
||||
|
||||
/**
|
||||
* Obtain an ApplicationContext for the given key, potentially cached.
|
||||
* @param key the context key; may be <code>null</code>.
|
||||
* @param key the context key; may be {@code null}.
|
||||
* @return the corresponding ApplicationContext instance (potentially cached),
|
||||
* or <code>null</code> if the provided <code>key</code> is <em>empty</em>
|
||||
* or {@code null} if the provided {@code key} is <em>empty</em>
|
||||
*/
|
||||
protected final ConfigurableApplicationContext getContext(Object key) throws Exception {
|
||||
if (isContextKeyEmpty(key)) {
|
||||
|
||||
@@ -103,7 +103,7 @@ public abstract class AbstractTransactionalDataSourceSpringContextTests
|
||||
/**
|
||||
* Convenient method to delete all rows from these tables.
|
||||
* Calling this method will make avoidance of rollback by calling
|
||||
* <code>setComplete()</code> impossible.
|
||||
* {@code setComplete()} impossible.
|
||||
* @see #setComplete
|
||||
*/
|
||||
protected void deleteFromTables(String[] names) {
|
||||
|
||||
@@ -182,7 +182,7 @@ public abstract class AbstractTransactionalSpringContextTests extends AbstractDe
|
||||
* <p>Override {@link #onSetUpBeforeTransaction()} and/or
|
||||
* {@link #onSetUpInTransaction()} to add custom set-up behavior for
|
||||
* transactional execution. Alternatively, override this method for general
|
||||
* set-up behavior, calling <code>super.onSetUp()</code> as part of your
|
||||
* set-up behavior, calling {@code super.onSetUp()} as part of your
|
||||
* method implementation.
|
||||
* @throws Exception simply let any exception propagate
|
||||
* @see #onTearDown()
|
||||
@@ -241,7 +241,7 @@ public abstract class AbstractTransactionalSpringContextTests extends AbstractDe
|
||||
* <p>Override {@link #onTearDownInTransaction()} and/or
|
||||
* {@link #onTearDownAfterTransaction()} to add custom tear-down behavior
|
||||
* for transactional execution. Alternatively, override this method for
|
||||
* general tear-down behavior, calling <code>super.onTearDown()</code> as
|
||||
* general tear-down behavior, calling {@code super.onTearDown()} as
|
||||
* part of your method implementation.
|
||||
* <p>Note that {@link #onTearDownInTransaction()} will only be called if a
|
||||
* transaction is still active at the time of the test shutdown. In
|
||||
@@ -305,7 +305,7 @@ public abstract class AbstractTransactionalSpringContextTests extends AbstractDe
|
||||
|
||||
/**
|
||||
* Immediately force a commit or rollback of the transaction, according to
|
||||
* the <code>complete</code> and {@link #isRollback() rollback} flags.
|
||||
* the {@code complete} and {@link #isRollback() rollback} flags.
|
||||
* <p>Can be used to explicitly let the transaction end early, for example to
|
||||
* check whether lazy associations of persistent objects work outside of a
|
||||
* transaction (that is, have been initialized properly).
|
||||
|
||||
@@ -46,21 +46,21 @@ package org.springframework.test;
|
||||
* }
|
||||
* }</pre>
|
||||
*
|
||||
* This will result in the test passing if the <code>Foo.someBusinessLogic(..)</code>
|
||||
* method threw an {@link java.lang.IllegalArgumentException}; if it did not, the
|
||||
* This will result in the test passing if the {@code Foo.someBusinessLogic(..)}
|
||||
* method threw an {@link IllegalArgumentException}; if it did not, the
|
||||
* test would fail with the following message:
|
||||
*
|
||||
* <pre class="code">
|
||||
* "Must have thrown a [class java.lang.IllegalArgumentException]"</pre>
|
||||
*
|
||||
* If the <b>wrong</b> type of {@link java.lang.Exception} was thrown, the
|
||||
* If the <b>wrong</b> type of {@link Exception} was thrown, the
|
||||
* test will also fail, this time with a message similar to the following:
|
||||
*
|
||||
* <pre class="code">
|
||||
* "junit.framework.AssertionFailedError: Was expecting a [class java.lang.UnsupportedOperationException] to be thrown, but instead a [class java.lang.IllegalArgumentException] was thrown"</pre>
|
||||
*
|
||||
* The test for the correct {@link java.lang.Exception} respects polymorphism,
|
||||
* so you can test that any old {@link java.lang.Exception} is thrown like so:
|
||||
* The test for the correct {@link Exception} respects polymorphism,
|
||||
* so you can test that any old {@link Exception} is thrown like so:
|
||||
*
|
||||
* <pre class="code">
|
||||
* public class FooTest {
|
||||
@@ -96,10 +96,10 @@ public abstract class AssertThrows {
|
||||
|
||||
/**
|
||||
* Create a new instance of the {@link AssertThrows} class.
|
||||
* @param expectedException the {@link java.lang.Exception} expected to be
|
||||
* @param expectedException the {@link Exception} expected to be
|
||||
* thrown during the execution of the surrounding test
|
||||
* @throws IllegalArgumentException if the supplied <code>expectedException</code> is
|
||||
* <code>null</code>; or if said argument is not an {@link java.lang.Exception}-derived class
|
||||
* @throws IllegalArgumentException if the supplied {@code expectedException} is
|
||||
* {@code null}; or if said argument is not an {@link Exception}-derived class
|
||||
*/
|
||||
public AssertThrows(Class expectedException) {
|
||||
this(expectedException, null);
|
||||
@@ -107,12 +107,12 @@ public abstract class AssertThrows {
|
||||
|
||||
/**
|
||||
* Create a new instance of the {@link AssertThrows} class.
|
||||
* @param expectedException the {@link java.lang.Exception} expected to be
|
||||
* @param expectedException the {@link Exception} expected to be
|
||||
* thrown during the execution of the surrounding test
|
||||
* @param failureMessage the extra, contextual failure message that will be
|
||||
* included in the failure text if the text fails (can be <code>null</code>)
|
||||
* @throws IllegalArgumentException if the supplied <code>expectedException</code> is
|
||||
* <code>null</code>; or if said argument is not an {@link java.lang.Exception}-derived class
|
||||
* included in the failure text if the text fails (can be {@code null})
|
||||
* @throws IllegalArgumentException if the supplied {@code expectedException} is
|
||||
* {@code null}; or if said argument is not an {@link Exception}-derived class
|
||||
*/
|
||||
public AssertThrows(Class expectedException, String failureMessage) {
|
||||
if (expectedException == null) {
|
||||
@@ -153,7 +153,7 @@ public abstract class AssertThrows {
|
||||
|
||||
|
||||
/**
|
||||
* Subclass must override this <code>abstract</code> method and
|
||||
* Subclass must override this {@code abstract} method and
|
||||
* provide the test logic.
|
||||
* @throws Exception if an error occurs during the execution of the
|
||||
* aformentioned test logic
|
||||
@@ -212,13 +212,13 @@ public abstract class AssertThrows {
|
||||
|
||||
/**
|
||||
* Does the donkey work of checking (verifying) that the
|
||||
* {@link java.lang.Exception} that was thrown in the body of a test is
|
||||
* {@link Exception} that was thrown in the body of a test is
|
||||
* an instance of the {@link #getExpectedException()} class (or an
|
||||
* instance of a subclass).
|
||||
* <p>If you want to customise the failure message, consider overriding
|
||||
* {@link #createMessageForWrongThrownExceptionType(Exception)}.
|
||||
* @param actualException the {@link java.lang.Exception} that has been thrown
|
||||
* in the body of a test method (will never be <code>null</code>)
|
||||
* @param actualException the {@link Exception} that has been thrown
|
||||
* in the body of a test method (will never be {@code null})
|
||||
*/
|
||||
protected void checkExceptionExpectations(Exception actualException) {
|
||||
if (!getExpectedException().isAssignableFrom(actualException.getClass())) {
|
||||
@@ -246,7 +246,7 @@ public abstract class AssertThrows {
|
||||
|
||||
/**
|
||||
* Expose the actual exception thrown from {@link #test}, if any.
|
||||
* @return the actual exception, or <code>null</code> if none
|
||||
* @return the actual exception, or {@code null} if none
|
||||
*/
|
||||
public final Exception getActualException() {
|
||||
return this.actualException;
|
||||
|
||||
@@ -98,7 +98,7 @@ public abstract class AbstractAnnotationAwareTransactionalTests extends
|
||||
|
||||
/**
|
||||
* Constructs a new AbstractAnnotationAwareTransactionalTests instance with
|
||||
* the specified JUnit <code>name</code> and retrieves the configured (or
|
||||
* the specified JUnit {@code name} and retrieves the configured (or
|
||||
* default) {@link ProfileValueSource}.
|
||||
* @param name the name of the current test
|
||||
* @see ProfileValueUtils#retrieveProfileValueSource(Class)
|
||||
@@ -119,10 +119,10 @@ public abstract class AbstractAnnotationAwareTransactionalTests extends
|
||||
/**
|
||||
* Search for a unique {@link ProfileValueSource} in the supplied
|
||||
* {@link ApplicationContext}. If found, the
|
||||
* <code>profileValueSource</code> for this test will be set to the unique
|
||||
* {@code profileValueSource} for this test will be set to the unique
|
||||
* {@link ProfileValueSource}.
|
||||
* @param applicationContext the ApplicationContext in which to search for
|
||||
* the ProfileValueSource; may not be <code>null</code>
|
||||
* the ProfileValueSource; may not be {@code null}
|
||||
* @deprecated Use {@link ProfileValueSourceConfiguration @ProfileValueSourceConfiguration} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -191,12 +191,12 @@ public abstract class AbstractAnnotationAwareTransactionalTests extends
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the test for the supplied <code>testMethod</code> should
|
||||
* Determine if the test for the supplied {@code testMethod} should
|
||||
* run in the current environment.
|
||||
* <p>The default implementation is based on
|
||||
* {@link IfProfileValue @IfProfileValue} semantics.
|
||||
* @param testMethod the test method
|
||||
* @return <code>true</code> if the test is <em>disabled</em> in the current environment
|
||||
* @return {@code true} if the test is <em>disabled</em> in the current environment
|
||||
* @see ProfileValueUtils#isTestEnabledInThisEnvironment
|
||||
*/
|
||||
protected boolean isDisabledInThisEnvironment(Method testMethod) {
|
||||
|
||||
@@ -41,9 +41,9 @@ import java.lang.annotation.Target;
|
||||
* context.
|
||||
* </p>
|
||||
* <p>
|
||||
* <code>@DirtiesContext</code> may be used as a class-level and
|
||||
* {@code @DirtiesContext} may be used as a class-level and
|
||||
* method-level annotation within the same class. In such scenarios, the
|
||||
* <code>ApplicationContext</code> will be marked as <em>dirty</em> after any
|
||||
* {@code ApplicationContext} will be marked as <em>dirty</em> after any
|
||||
* such annotated method as well as after the entire class. If the
|
||||
* {@link ClassMode} is set to {@link ClassMode#AFTER_EACH_TEST_METHOD
|
||||
* AFTER_EACH_TEST_METHOD}, the context will be marked dirty after each test
|
||||
@@ -61,19 +61,19 @@ import java.lang.annotation.Target;
|
||||
public @interface DirtiesContext {
|
||||
|
||||
/**
|
||||
* Defines <i>modes</i> which determine how <code>@DirtiesContext</code>
|
||||
* Defines <i>modes</i> which determine how {@code @DirtiesContext}
|
||||
* is interpreted when used to annotate a test class.
|
||||
*/
|
||||
static enum ClassMode {
|
||||
|
||||
/**
|
||||
* The associated <code>ApplicationContext</code> will be marked as
|
||||
* The associated {@code ApplicationContext} will be marked as
|
||||
* <em>dirty</em> after the test class.
|
||||
*/
|
||||
AFTER_CLASS,
|
||||
|
||||
/**
|
||||
* The associated <code>ApplicationContext</code> will be marked as
|
||||
* The associated {@code ApplicationContext} will be marked as
|
||||
* <em>dirty</em> after each test method in the class.
|
||||
*/
|
||||
AFTER_EACH_TEST_METHOD
|
||||
@@ -82,10 +82,10 @@ public @interface DirtiesContext {
|
||||
|
||||
/**
|
||||
* The <i>mode</i> to use when a test class is annotated with
|
||||
* <code>@DirtiesContext</code>.
|
||||
* {@code @DirtiesContext}.
|
||||
* <p>Defaults to {@link ClassMode#AFTER_CLASS AFTER_CLASS}.
|
||||
* <p>Note: Setting the class mode on an annotated test method has no meaning,
|
||||
* since the mere presence of the <code>@DirtiesContext</code>
|
||||
* since the mere presence of the {@code @DirtiesContext}
|
||||
* annotation on a test method is sufficient.
|
||||
*/
|
||||
ClassMode classMode() default ClassMode.AFTER_CLASS;
|
||||
|
||||
@@ -31,9 +31,9 @@ import java.lang.annotation.Target;
|
||||
* test will be enabled.
|
||||
* </p>
|
||||
* <p>
|
||||
* Note: <code>@IfProfileValue</code> can be applied at the class level,
|
||||
* the method level, or both. <code>@IfProfileValue</code> at the class
|
||||
* level overrides method-level usage of <code>@IfProfileValue</code> for
|
||||
* Note: {@code @IfProfileValue} can be applied at the class level,
|
||||
* the method level, or both. {@code @IfProfileValue} at the class
|
||||
* level overrides method-level usage of {@code @IfProfileValue} for
|
||||
* any methods within that class.
|
||||
* </p>
|
||||
* <p>
|
||||
@@ -49,7 +49,7 @@ import java.lang.annotation.Target;
|
||||
* }
|
||||
* </pre>
|
||||
* <p>
|
||||
* You can alternatively configure <code>@IfProfileValue</code> with
|
||||
* You can alternatively configure {@code @IfProfileValue} with
|
||||
* <em>OR</em> semantics for multiple {@link #values() values} as follows
|
||||
* (assuming a {@link ProfileValueSource} has been appropriately configured for
|
||||
* the "test-groups" name):
|
||||
@@ -79,13 +79,13 @@ import java.lang.annotation.Target;
|
||||
public @interface IfProfileValue {
|
||||
|
||||
/**
|
||||
* The <code>name</code> of the <em>profile value</em> against which to
|
||||
* The {@code name} of the <em>profile value</em> against which to
|
||||
* test.
|
||||
*/
|
||||
String name();
|
||||
|
||||
/**
|
||||
* A single, permissible <code>value</code> of the <em>profile value</em>
|
||||
* A single, permissible {@code value} of the <em>profile value</em>
|
||||
* for the given {@link #name() name}.
|
||||
* <p>
|
||||
* Note: Assigning values to both {@link #value()} and {@link #values()}
|
||||
@@ -94,7 +94,7 @@ public @interface IfProfileValue {
|
||||
String value() default "";
|
||||
|
||||
/**
|
||||
* A list of all permissible <code>values</code> of the
|
||||
* A list of all permissible {@code values} of the
|
||||
* <em>profile value</em> for the given {@link #name() name}.
|
||||
* <p>
|
||||
* Note: Assigning values to both {@link #value()} and {@link #values()}
|
||||
|
||||
@@ -22,7 +22,7 @@ package org.springframework.test.annotation;
|
||||
* testing environment.
|
||||
* </p>
|
||||
* <p>
|
||||
* Concrete implementations must provide a <code>public</code> no-args
|
||||
* Concrete implementations must provide a {@code public} no-args
|
||||
* constructor.
|
||||
* </p>
|
||||
* <p>
|
||||
@@ -44,7 +44,7 @@ public interface ProfileValueSource {
|
||||
/**
|
||||
* Get the <em>profile value</em> indicated by the specified key.
|
||||
* @param key the name of the <em>profile value</em>
|
||||
* @return the String value of the <em>profile value</em>, or <code>null</code>
|
||||
* @return the String value of the <em>profile value</em>, or {@code null}
|
||||
* if there is no <em>profile value</em> with that key
|
||||
*/
|
||||
String get(String key);
|
||||
|
||||
@@ -102,15 +102,15 @@ public abstract class ProfileValueUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the supplied <code>testClass</code> is <em>enabled</em> in
|
||||
* Determine if the supplied {@code testClass} is <em>enabled</em> in
|
||||
* the current environment, as specified by the {@link IfProfileValue
|
||||
* @IfProfileValue} annotation at the class level.
|
||||
* <p>
|
||||
* Defaults to <code>true</code> if no {@link IfProfileValue
|
||||
* Defaults to {@code true} if no {@link IfProfileValue
|
||||
* @IfProfileValue} annotation is declared.
|
||||
*
|
||||
* @param testClass the test class
|
||||
* @return <code>true</code> if the test is <em>enabled</em> in the current
|
||||
* @return {@code true} if the test is <em>enabled</em> in the current
|
||||
* environment
|
||||
*/
|
||||
public static boolean isTestEnabledInThisEnvironment(Class<?> testClass) {
|
||||
@@ -119,18 +119,18 @@ public abstract class ProfileValueUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the supplied <code>testMethod</code> is <em>enabled</em> in
|
||||
* Determine if the supplied {@code testMethod} is <em>enabled</em> in
|
||||
* the current environment, as specified by the {@link IfProfileValue
|
||||
* @IfProfileValue} annotation, which may be declared on the test
|
||||
* method itself or at the class level. Class-level usage overrides
|
||||
* method-level usage.
|
||||
* <p>
|
||||
* Defaults to <code>true</code> if no {@link IfProfileValue
|
||||
* Defaults to {@code true} if no {@link IfProfileValue
|
||||
* @IfProfileValue} annotation is declared.
|
||||
*
|
||||
* @param testMethod the test method
|
||||
* @param testClass the test class
|
||||
* @return <code>true</code> if the test is <em>enabled</em> in the current
|
||||
* @return {@code true} if the test is <em>enabled</em> in the current
|
||||
* environment
|
||||
*/
|
||||
public static boolean isTestEnabledInThisEnvironment(Method testMethod, Class<?> testClass) {
|
||||
@@ -138,20 +138,20 @@ public abstract class ProfileValueUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the supplied <code>testMethod</code> is <em>enabled</em> in
|
||||
* Determine if the supplied {@code testMethod} is <em>enabled</em> in
|
||||
* the current environment, as specified by the {@link IfProfileValue
|
||||
* @IfProfileValue} annotation, which may be declared on the test
|
||||
* method itself or at the class level. Class-level usage overrides
|
||||
* method-level usage.
|
||||
* <p>
|
||||
* Defaults to <code>true</code> if no {@link IfProfileValue
|
||||
* Defaults to {@code true} if no {@link IfProfileValue
|
||||
* @IfProfileValue} annotation is declared.
|
||||
*
|
||||
* @param profileValueSource the ProfileValueSource to use to determine if
|
||||
* the test is enabled
|
||||
* @param testMethod the test method
|
||||
* @param testClass the test class
|
||||
* @return <code>true</code> if the test is <em>enabled</em> in the current
|
||||
* @return {@code true} if the test is <em>enabled</em> in the current
|
||||
* environment
|
||||
*/
|
||||
public static boolean isTestEnabledInThisEnvironment(ProfileValueSource profileValueSource, Method testMethod,
|
||||
@@ -169,17 +169,17 @@ public abstract class ProfileValueUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the <code>value</code> (or one of the <code>values</code>)
|
||||
* Determine if the {@code value} (or one of the {@code values})
|
||||
* in the supplied {@link IfProfileValue @IfProfileValue} annotation is
|
||||
* <em>enabled</em> in the current environment.
|
||||
*
|
||||
* @param profileValueSource the ProfileValueSource to use to determine if
|
||||
* the test is enabled
|
||||
* @param ifProfileValue the annotation to introspect; may be
|
||||
* <code>null</code>
|
||||
* @return <code>true</code> if the test is <em>enabled</em> in the current
|
||||
* environment or if the supplied <code>ifProfileValue</code> is
|
||||
* <code>null</code>
|
||||
* {@code null}
|
||||
* @return {@code true} if the test is <em>enabled</em> in the current
|
||||
* environment or if the supplied {@code ifProfileValue} is
|
||||
* {@code null}
|
||||
*/
|
||||
private static boolean isTestEnabledInThisEnvironment(ProfileValueSource profileValueSource,
|
||||
IfProfileValue ifProfileValue) {
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.lang.annotation.Target;
|
||||
/**
|
||||
* Test annotation to indicate whether or not the transaction for the annotated
|
||||
* test method should be <em>rolled back</em> after the test method has
|
||||
* completed. If <code>true</code>, the transaction will be rolled back;
|
||||
* completed. If {@code true}, the transaction will be rolled back;
|
||||
* otherwise, the transaction will be committed.
|
||||
*
|
||||
* @author Sam Brannen
|
||||
|
||||
@@ -65,14 +65,14 @@ public @interface ActiveProfiles {
|
||||
* Whether or not bean definition profiles from superclasses should be
|
||||
* <em>inherited</em>.
|
||||
*
|
||||
* <p>The default value is <code>true</code>, which means that a test
|
||||
* <p>The default value is {@code true}, which means that a test
|
||||
* class will <em>inherit</em> bean definition profiles defined by a
|
||||
* test superclass. Specifically, the bean definition profiles for a test
|
||||
* class will be appended to the list of bean definition profiles
|
||||
* defined by a test superclass. Thus, subclasses have the option of
|
||||
* <em>extending</em> the list of bean definition profiles.
|
||||
*
|
||||
* <p>If <code>inheritProfiles</code> is set to <code>false</code>, the bean
|
||||
* <p>If {@code inheritProfiles} is set to {@code false}, the bean
|
||||
* definition profiles for the test class will <em>shadow</em> and
|
||||
* effectively replace any bean definition profiles defined by a superclass.
|
||||
*
|
||||
|
||||
@@ -70,7 +70,7 @@ class ContextCache {
|
||||
|
||||
/**
|
||||
* Return whether there is a cached context for the given key.
|
||||
* @param key the context key (never <code>null</code>)
|
||||
* @param key the context key (never {@code null})
|
||||
*/
|
||||
boolean contains(MergedContextConfiguration key) {
|
||||
Assert.notNull(key, "Key must not be null");
|
||||
@@ -81,9 +81,9 @@ class ContextCache {
|
||||
* Obtain a cached ApplicationContext for the given key.
|
||||
* <p>The {@link #getHitCount() hit} and {@link #getMissCount() miss}
|
||||
* counts will be updated accordingly.
|
||||
* @param key the context key (never <code>null</code>)
|
||||
* @param key the context key (never {@code null})
|
||||
* @return the corresponding ApplicationContext instance,
|
||||
* or <code>null</code> if not found in the cache.
|
||||
* or {@code null} if not found in the cache.
|
||||
* @see #remove
|
||||
*/
|
||||
ApplicationContext get(MergedContextConfiguration key) {
|
||||
@@ -108,7 +108,7 @@ class ContextCache {
|
||||
|
||||
/**
|
||||
* Increment the miss count by one. A <em>miss</em> is an access to the
|
||||
* cache, which returned a <code>null</code> context for a queried key.
|
||||
* cache, which returned a {@code null} context for a queried key.
|
||||
*/
|
||||
private void incrementMissCount() {
|
||||
this.missCount++;
|
||||
@@ -124,7 +124,7 @@ class ContextCache {
|
||||
|
||||
/**
|
||||
* Get the overall miss count for this cache. A <em>miss</em> is an
|
||||
* access to the cache, which returned a <code>null</code> context for a
|
||||
* access to the cache, which returned a {@code null} context for a
|
||||
* queried key.
|
||||
*/
|
||||
int getMissCount() {
|
||||
@@ -133,8 +133,8 @@ class ContextCache {
|
||||
|
||||
/**
|
||||
* Explicitly add an ApplicationContext instance to the cache under the given key.
|
||||
* @param key the context key (never <code>null</code>)
|
||||
* @param context the ApplicationContext instance (never <code>null</code>)
|
||||
* @param key the context key (never {@code null})
|
||||
* @param context the ApplicationContext instance (never {@code null})
|
||||
*/
|
||||
void put(MergedContextConfiguration key, ApplicationContext context) {
|
||||
Assert.notNull(key, "Key must not be null");
|
||||
@@ -144,8 +144,8 @@ class ContextCache {
|
||||
|
||||
/**
|
||||
* Remove the context with the given key.
|
||||
* @param key the context key (never <code>null</code>)
|
||||
* @return the corresponding ApplicationContext instance, or <code>null</code>
|
||||
* @param key the context key (never {@code null})
|
||||
* @return the corresponding ApplicationContext instance, or {@code null}
|
||||
* if not found in the cache.
|
||||
* @see #setDirty
|
||||
*/
|
||||
@@ -161,7 +161,7 @@ class ContextCache {
|
||||
* <p>Generally speaking, you would only call this method if you change the
|
||||
* state of a singleton bean, potentially affecting future interaction with
|
||||
* the context.
|
||||
* @param key the context key (never <code>null</code>)
|
||||
* @param key the context key (never {@code null})
|
||||
* @see #remove
|
||||
*/
|
||||
void setDirty(MergedContextConfiguration key) {
|
||||
|
||||
@@ -108,7 +108,7 @@ public @interface ContextConfiguration {
|
||||
* AbstractContextLoader} subclass such as
|
||||
* {@link org.springframework.test.context.support.GenericXmlContextLoader
|
||||
* GenericXmlContextLoader} which is the effective default implementation
|
||||
* used at runtime if <code>locations</code> are configured. See the
|
||||
* used at runtime if {@code locations} are configured. See the
|
||||
* documentation for {@link #loader} for further details regarding default
|
||||
* loaders.
|
||||
*
|
||||
@@ -166,7 +166,7 @@ public @interface ContextConfiguration {
|
||||
* Whether or not {@link #locations resource locations} or <em>annotated
|
||||
* classes</em> from test superclasses should be <em>inherited</em>.
|
||||
*
|
||||
* <p>The default value is <code>true</code>. This means that an annotated
|
||||
* <p>The default value is {@code true}. This means that an annotated
|
||||
* class will <em>inherit</em> the resource locations or annotated classes
|
||||
* defined by test superclasses. Specifically, the resource locations or
|
||||
* annotated classes for a given test class will be appended to the list of
|
||||
@@ -174,7 +174,7 @@ public @interface ContextConfiguration {
|
||||
* Thus, subclasses have the option of <em>extending</em> the list of resource
|
||||
* locations or annotated classes.
|
||||
*
|
||||
* <p>If <code>inheritLocations</code> is set to <code>false</code>, the
|
||||
* <p>If {@code inheritLocations} is set to {@code false}, the
|
||||
* resource locations or annotated classes for the annotated class
|
||||
* will <em>shadow</em> and effectively replace any resource locations
|
||||
* or annotated classes defined by superclasses.
|
||||
@@ -225,14 +225,14 @@ public @interface ContextConfiguration {
|
||||
* Whether or not {@linkplain #initializers context initializers} from test
|
||||
* superclasses should be <em>inherited</em>.
|
||||
*
|
||||
* <p>The default value is <code>true</code>. This means that an annotated
|
||||
* <p>The default value is {@code true}. This means that an annotated
|
||||
* class will <em>inherit</em> the application context initializers defined
|
||||
* by test superclasses. Specifically, the initializers for a given test
|
||||
* class will be added to the set of initializers defined by test
|
||||
* superclasses. Thus, subclasses have the option of <em>extending</em> the
|
||||
* set of initializers.
|
||||
*
|
||||
* <p>If <code>inheritInitializers</code> is set to <code>false</code>, the
|
||||
* <p>If {@code inheritInitializers} is set to {@code false}, the
|
||||
* initializers for the annotated class will <em>shadow</em> and effectively
|
||||
* replace any initializers defined by superclasses.
|
||||
*
|
||||
|
||||
@@ -27,13 +27,13 @@ import org.springframework.context.ApplicationContext;
|
||||
* bean definition profiles, and application context initializers.
|
||||
*
|
||||
* <p>Clients of a ContextLoader should call
|
||||
* {@link #processLocations(Class,String...) processLocations()} prior to
|
||||
* {@link #processLocations(Class, String...) processLocations()} prior to
|
||||
* calling {@link #loadContext(String...) loadContext()} in case the
|
||||
* ContextLoader provides custom support for modifying or generating locations.
|
||||
* The results of {@link #processLocations(Class,String...) processLocations()}
|
||||
* The results of {@link #processLocations(Class, String...) processLocations()}
|
||||
* should then be supplied to {@link #loadContext(String...) loadContext()}.
|
||||
*
|
||||
* <p>Concrete implementations must provide a <code>public</code> no-args
|
||||
* <p>Concrete implementations must provide a {@code public} no-args
|
||||
* constructor.
|
||||
*
|
||||
* <p>Spring provides the following out-of-the-box implementations:
|
||||
@@ -59,14 +59,14 @@ public interface ContextLoader {
|
||||
* @param clazz the class with which the locations are associated: used to
|
||||
* determine how to process the supplied locations
|
||||
* @param locations the unmodified locations to use for loading the
|
||||
* application context (can be <code>null</code> or empty)
|
||||
* application context (can be {@code null} or empty)
|
||||
* @return an array of application context resource locations
|
||||
*/
|
||||
String[] processLocations(Class<?> clazz, String... locations);
|
||||
|
||||
/**
|
||||
* Loads a new {@link ApplicationContext context} based on the supplied
|
||||
* <code>locations</code>, configures the context, and finally returns
|
||||
* {@code locations}, configures the context, and finally returns
|
||||
* the context in fully <em>refreshed</em> state.
|
||||
*
|
||||
* <p>Configuration locations are generally considered to be classpath
|
||||
|
||||
@@ -72,7 +72,7 @@ abstract class ContextLoaderUtils {
|
||||
* supplied list of {@link ContextConfigurationAttributes} and then
|
||||
* instantiate and return that {@code ContextLoader}.
|
||||
*
|
||||
* <p>If the supplied <code>defaultContextLoaderClassName</code> is
|
||||
* <p>If the supplied {@code defaultContextLoaderClassName} is
|
||||
* {@code null} or <em>empty</em>, depending on the absence or presence
|
||||
* of {@link org.springframework.test.context.web.WebAppConfiguration @WebAppConfiguration}
|
||||
* either {@value #DEFAULT_CONTEXT_LOADER_CLASS_NAME}
|
||||
@@ -88,7 +88,7 @@ abstract class ContextLoaderUtils {
|
||||
* @param defaultContextLoaderClassName the name of the default
|
||||
* {@code ContextLoader} class to use; may be {@code null} or <em>empty</em>
|
||||
* @return the resolved {@code ContextLoader} for the supplied
|
||||
* <code>testClass</code> (never {@code null})
|
||||
* {@code testClass} (never {@code null})
|
||||
* @see #resolveContextLoaderClass()
|
||||
*/
|
||||
static ContextLoader resolveContextLoader(Class<?> testClass,
|
||||
@@ -125,7 +125,7 @@ abstract class ContextLoaderUtils {
|
||||
* and return to step #1.</li>
|
||||
* <li>If no explicit {@code ContextLoader} class is found after traversing
|
||||
* the hierarchy, an attempt will be made to load and return the class
|
||||
* with the supplied <code>defaultContextLoaderClassName</code>.</li>
|
||||
* with the supplied {@code defaultContextLoaderClassName}.</li>
|
||||
* </ol>
|
||||
*
|
||||
* @param testClass the class for which to resolve the {@code ContextLoader}
|
||||
@@ -236,8 +236,8 @@ abstract class ContextLoaderUtils {
|
||||
*
|
||||
* <p>Note that the {@link ContextConfiguration#inheritInitializers inheritInitializers}
|
||||
* flag of {@link ContextConfiguration @ContextConfiguration} will be taken into
|
||||
* consideration. Specifically, if the <code>inheritInitializers</code> flag is
|
||||
* set to <code>true</code> for a given level in the class hierarchy represented by
|
||||
* consideration. Specifically, if the {@code inheritInitializers} flag is
|
||||
* set to {@code true} for a given level in the class hierarchy represented by
|
||||
* the provided configuration attributes, context initializer classes defined
|
||||
* at the given level will be merged with those defined in higher levels
|
||||
* of the class hierarchy.
|
||||
@@ -277,15 +277,15 @@ abstract class ContextLoaderUtils {
|
||||
*
|
||||
* <p>Note that the {@link ActiveProfiles#inheritProfiles inheritProfiles}
|
||||
* flag of {@link ActiveProfiles @ActiveProfiles} will be taken into
|
||||
* consideration. Specifically, if the <code>inheritProfiles</code> flag is
|
||||
* set to <code>true</code>, profiles defined in the test class will be
|
||||
* consideration. Specifically, if the {@code inheritProfiles} flag is
|
||||
* set to {@code true}, profiles defined in the test class will be
|
||||
* merged with those defined in superclasses.
|
||||
*
|
||||
* @param testClass the class for which to resolve the active profiles (must
|
||||
* not be {@code null})
|
||||
* @return the set of active profiles for the specified class, including
|
||||
* active profiles from superclasses if appropriate (never {@code null})
|
||||
* @see org.springframework.test.context.ActiveProfiles
|
||||
* @see ActiveProfiles
|
||||
* @see org.springframework.context.annotation.Profile
|
||||
*/
|
||||
static String[] resolveActiveProfiles(Class<?> testClass) {
|
||||
@@ -341,7 +341,7 @@ abstract class ContextLoaderUtils {
|
||||
/**
|
||||
* Build the {@link MergedContextConfiguration merged context configuration}
|
||||
* for the supplied {@link Class testClass} and
|
||||
* <code>defaultContextLoaderClassName</code>.
|
||||
* {@code defaultContextLoaderClassName}.
|
||||
*
|
||||
* @param testClass the test class for which the {@code MergedContextConfiguration}
|
||||
* should be built (must not be {@code null})
|
||||
@@ -408,7 +408,7 @@ abstract class ContextLoaderUtils {
|
||||
* Load the {@link org.springframework.test.context.web.WebAppConfiguration @WebAppConfiguration}
|
||||
* class, using reflection in order to avoid package cycles.
|
||||
*
|
||||
* @return the {@code @WebAppConfiguration} class or <code>null</code> if it
|
||||
* @return the {@code @WebAppConfiguration} class or {@code null} if it
|
||||
* cannot be loaded
|
||||
* @since 3.2
|
||||
*/
|
||||
@@ -432,7 +432,7 @@ abstract class ContextLoaderUtils {
|
||||
* WebMergedContextConfiguration} from the supplied arguments, using reflection
|
||||
* in order to avoid package cycles.
|
||||
*
|
||||
* @return the {@code WebMergedContextConfiguration} or <code>null</code> if
|
||||
* @return the {@code WebMergedContextConfiguration} or {@code null} if
|
||||
* it could not be built
|
||||
* @since 3.2
|
||||
*/
|
||||
|
||||
@@ -103,7 +103,7 @@ public class MergedContextConfiguration implements Serializable {
|
||||
/**
|
||||
* Generate a null-safe {@link String} representation of the supplied
|
||||
* {@link ContextLoader} based solely on the fully qualified name of the
|
||||
* loader or "null" if the supplied loaded is <code>null</code>.
|
||||
* loader or "null" if the supplied loaded is {@code null}.
|
||||
*/
|
||||
protected static String nullSafeToString(ContextLoader contextLoader) {
|
||||
return contextLoader == null ? "null" : contextLoader.getClass().getName();
|
||||
@@ -114,8 +114,8 @@ public class MergedContextConfiguration implements Serializable {
|
||||
* supplied test class, resource locations, annotated classes, active
|
||||
* profiles, and {@code ContextLoader}.
|
||||
*
|
||||
* <p>If a <code>null</code> value is supplied for <code>locations</code>,
|
||||
* <code>classes</code>, or <code>activeProfiles</code> an empty array will
|
||||
* <p>If a {@code null} value is supplied for {@code locations},
|
||||
* {@code classes}, or {@code activeProfiles} an empty array will
|
||||
* be stored instead. Furthermore, active profiles will be sorted, and duplicate
|
||||
* profiles will be removed.
|
||||
*
|
||||
@@ -123,7 +123,7 @@ public class MergedContextConfiguration implements Serializable {
|
||||
* @param locations the merged resource locations
|
||||
* @param classes the merged annotated classes
|
||||
* @param activeProfiles the merged active bean definition profiles
|
||||
* @param contextLoader the resolved <code>ContextLoader</code>
|
||||
* @param contextLoader the resolved {@code ContextLoader}
|
||||
* @see #MergedContextConfiguration(Class, String[], Class[], Set, String[], ContextLoader)
|
||||
*/
|
||||
public MergedContextConfiguration(Class<?> testClass, String[] locations, Class<?>[] classes,
|
||||
@@ -136,10 +136,10 @@ public class MergedContextConfiguration implements Serializable {
|
||||
* supplied test class, resource locations, annotated classes, context
|
||||
* initializers, active profiles, and {@code ContextLoader}.
|
||||
*
|
||||
* <p>If a <code>null</code> value is supplied for <code>locations</code>,
|
||||
* <code>classes</code>, or <code>activeProfiles</code> an empty array will
|
||||
* be stored instead. If a <code>null</code> value is supplied for the
|
||||
* <code>contextInitializerClasses</code> an empty set will be stored instead.
|
||||
* <p>If a {@code null} value is supplied for {@code locations},
|
||||
* {@code classes}, or {@code activeProfiles} an empty array will
|
||||
* be stored instead. If a {@code null} value is supplied for the
|
||||
* {@code contextInitializerClasses} an empty set will be stored instead.
|
||||
* Furthermore, active profiles will be sorted, and duplicate profiles will
|
||||
* be removed.
|
||||
*
|
||||
@@ -148,7 +148,7 @@ public class MergedContextConfiguration implements Serializable {
|
||||
* @param classes the merged annotated classes
|
||||
* @param contextInitializerClasses the merged context initializer classes
|
||||
* @param activeProfiles the merged active bean definition profiles
|
||||
* @param contextLoader the resolved <code>ContextLoader</code>
|
||||
* @param contextLoader the resolved {@code ContextLoader}
|
||||
*/
|
||||
public MergedContextConfiguration(
|
||||
Class<?> testClass,
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.springframework.context.ApplicationContext;
|
||||
* and {@link #loadContext(MergedContextConfiguration)}).
|
||||
*
|
||||
* <p>See the Javadoc for
|
||||
* {@link org.springframework.test.context.ContextConfiguration @ContextConfiguration}
|
||||
* {@link ContextConfiguration @ContextConfiguration}
|
||||
* for a definition of <em>annotated class</em>.
|
||||
*
|
||||
* <p>Clients of a {@code SmartContextLoader} should call
|
||||
@@ -51,7 +51,7 @@ import org.springframework.context.ApplicationContext;
|
||||
* {@code SmartContextLoader} may choose not to support methods defined in
|
||||
* the {@code ContextLoader} SPI.
|
||||
*
|
||||
* <p>Concrete implementations must provide a <code>public</code> no-args constructor.
|
||||
* <p>Concrete implementations must provide a {@code public} no-args constructor.
|
||||
*
|
||||
* <p>Spring provides the following out-of-the-box implementations:
|
||||
* <ul>
|
||||
@@ -72,17 +72,17 @@ public interface SmartContextLoader extends ContextLoader {
|
||||
|
||||
/**
|
||||
* Processes the {@link ContextConfigurationAttributes} for a given test class.
|
||||
* <p>Concrete implementations may choose to <em>modify</em> the <code>locations</code>
|
||||
* or <code>classes</code> in the supplied {@link ContextConfigurationAttributes},
|
||||
* <p>Concrete implementations may choose to <em>modify</em> the {@code locations}
|
||||
* or {@code classes} in the supplied {@link ContextConfigurationAttributes},
|
||||
* <em>generate</em> default configuration locations, or <em>detect</em>
|
||||
* default configuration classes if the supplied values are <code>null</code>
|
||||
* default configuration classes if the supplied values are {@code null}
|
||||
* or empty.
|
||||
* <p><b>Note</b>: in contrast to a standard {@code ContextLoader}, a
|
||||
* {@code SmartContextLoader} <b>must</b> <em>preemptively</em> verify that
|
||||
* a generated or detected default actually exists before setting the corresponding
|
||||
* <code>locations</code> or <code>classes</code> property in the supplied
|
||||
* {@code locations} or {@code classes} property in the supplied
|
||||
* {@link ContextConfigurationAttributes}. Consequently, leaving the
|
||||
* <code>locations</code> or <code>classes</code> property empty signals that
|
||||
* {@code locations} or {@code classes} property empty signals that
|
||||
* this {@code SmartContextLoader} was not able to generate or detect defaults.
|
||||
* @param configAttributes the context configuration attributes to process
|
||||
*/
|
||||
@@ -103,7 +103,7 @@ public interface SmartContextLoader extends ContextLoader {
|
||||
* {@link javax.inject.Inject @Inject}. In addition, concrete implementations
|
||||
* should set the active bean definition profiles in the context's
|
||||
* {@link org.springframework.core.env.Environment Environment}.
|
||||
* <p>Any <code>ApplicationContext</code> loaded by a
|
||||
* <p>Any {@code ApplicationContext} loaded by a
|
||||
* {@code SmartContextLoader} <strong>must</strong> register a JVM
|
||||
* shutdown hook for itself. Unless the context gets closed early, all context
|
||||
* instances will be automatically closed on JVM shutdown. This allows for
|
||||
@@ -116,7 +116,7 @@ public interface SmartContextLoader extends ContextLoader {
|
||||
* @see #processContextConfiguration(ContextConfigurationAttributes)
|
||||
* @see org.springframework.context.annotation.AnnotationConfigUtils
|
||||
* #registerAnnotationConfigProcessors(org.springframework.beans.factory.support.BeanDefinitionRegistry)
|
||||
* @see org.springframework.test.context.MergedContextConfiguration#getActiveProfiles()
|
||||
* @see MergedContextConfiguration#getActiveProfiles()
|
||||
* @see org.springframework.context.ConfigurableApplicationContext#getEnvironment()
|
||||
*/
|
||||
ApplicationContext loadContext(MergedContextConfiguration mergedConfig) throws Exception;
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.springframework.core.style.ToStringCreator;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* <code>TestContext</code> encapsulates the context in which a test is executed,
|
||||
* {@code TestContext} encapsulates the context in which a test is executed,
|
||||
* agnostic of the actual testing framework in use.
|
||||
*
|
||||
* @author Sam Brannen
|
||||
@@ -54,7 +54,7 @@ public class TestContext extends AttributeAccessorSupport {
|
||||
|
||||
/**
|
||||
* Delegates to {@link #TestContext(Class, ContextCache, String)} with a
|
||||
* value of <code>null</code> for the default {@code ContextLoader} class name.
|
||||
* value of {@code null} for the default {@code ContextLoader} class name.
|
||||
*/
|
||||
TestContext(Class<?> testClass, ContextCache contextCache) {
|
||||
this(testClass, contextCache, null);
|
||||
@@ -66,18 +66,18 @@ public class TestContext extends AttributeAccessorSupport {
|
||||
* {@link ContextConfiguration @ContextConfiguration} annotation, if
|
||||
* present.
|
||||
* <p>If the supplied class name for the default {@code ContextLoader}
|
||||
* is <code>null</code> or <em>empty</em> and no concrete {@code ContextLoader}
|
||||
* is {@code null} or <em>empty</em> and no concrete {@code ContextLoader}
|
||||
* class is explicitly supplied via the {@code @ContextConfiguration}
|
||||
* annotation, a
|
||||
* {@link org.springframework.test.context.support.DelegatingSmartContextLoader
|
||||
* DelegatingSmartContextLoader} will be used instead.
|
||||
* @param testClass the test class for which the test context should be
|
||||
* constructed (must not be <code>null</code>)
|
||||
* constructed (must not be {@code null})
|
||||
* @param contextCache the context cache from which the constructed test
|
||||
* context should retrieve application contexts (must not be
|
||||
* <code>null</code>)
|
||||
* {@code null})
|
||||
* @param defaultContextLoaderClassName the name of the default
|
||||
* {@code ContextLoader} class to use (may be <code>null</code>)
|
||||
* {@code ContextLoader} class to use (may be {@code null})
|
||||
*/
|
||||
TestContext(Class<?> testClass, ContextCache contextCache, String defaultContextLoaderClassName) {
|
||||
Assert.notNull(testClass, "Test class must not be null");
|
||||
@@ -107,7 +107,7 @@ public class TestContext extends AttributeAccessorSupport {
|
||||
}
|
||||
|
||||
/**
|
||||
* Load an <code>ApplicationContext</code> for this test context using the
|
||||
* Load an {@code ApplicationContext} for this test context using the
|
||||
* configured {@code ContextLoader} and merged context configuration. Supports
|
||||
* both the {@link SmartContextLoader} and {@link ContextLoader} SPIs.
|
||||
* @throws Exception if an error occurs while loading the application context
|
||||
@@ -170,7 +170,7 @@ public class TestContext extends AttributeAccessorSupport {
|
||||
|
||||
/**
|
||||
* Get the {@link Class test class} for this test context.
|
||||
* @return the test class (never <code>null</code>)
|
||||
* @return the test class (never {@code null})
|
||||
*/
|
||||
public final Class<?> getTestClass() {
|
||||
return testClass;
|
||||
@@ -179,8 +179,8 @@ public class TestContext extends AttributeAccessorSupport {
|
||||
/**
|
||||
* Get the current {@link Object test instance} for this test context.
|
||||
* <p>Note: this is a mutable property.
|
||||
* @return the current test instance (may be <code>null</code>)
|
||||
* @see #updateState(Object,Method,Throwable)
|
||||
* @return the current test instance (may be {@code null})
|
||||
* @see #updateState(Object, Method, Throwable)
|
||||
*/
|
||||
public final Object getTestInstance() {
|
||||
return testInstance;
|
||||
@@ -189,7 +189,7 @@ public class TestContext extends AttributeAccessorSupport {
|
||||
/**
|
||||
* Get the current {@link Method test method} for this test context.
|
||||
* <p>Note: this is a mutable property.
|
||||
* @return the current test method (may be <code>null</code>)
|
||||
* @return the current test method (may be {@code null})
|
||||
* @see #updateState(Object, Method, Throwable)
|
||||
*/
|
||||
public final Method getTestMethod() {
|
||||
@@ -200,7 +200,7 @@ public class TestContext extends AttributeAccessorSupport {
|
||||
* Get the {@link Throwable exception} that was thrown during execution of
|
||||
* the {@link #getTestMethod() test method}.
|
||||
* <p>Note: this is a mutable property.
|
||||
* @return the exception that was thrown, or <code>null</code> if no
|
||||
* @return the exception that was thrown, or {@code null} if no
|
||||
* exception was thrown
|
||||
* @see #updateState(Object, Method, Throwable)
|
||||
*/
|
||||
@@ -223,10 +223,10 @@ public class TestContext extends AttributeAccessorSupport {
|
||||
/**
|
||||
* Update this test context to reflect the state of the currently executing
|
||||
* test.
|
||||
* @param testInstance the current test instance (may be <code>null</code>)
|
||||
* @param testMethod the current test method (may be <code>null</code>)
|
||||
* @param testInstance the current test instance (may be {@code null})
|
||||
* @param testMethod the current test method (may be {@code null})
|
||||
* @param testException the exception that was thrown in the test method, or
|
||||
* <code>null</code> if no exception was thrown
|
||||
* {@code null} if no exception was thrown
|
||||
*/
|
||||
void updateState(Object testInstance, Method testMethod, Throwable testException) {
|
||||
this.testInstance = testInstance;
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* <code>TestContextManager</code> is the main entry point into the
|
||||
* {@code TestContextManager} is the main entry point into the
|
||||
* <em>Spring TestContext Framework</em>, which provides support for loading and
|
||||
* accessing {@link ApplicationContext application contexts}, dependency
|
||||
* injection of test instances,
|
||||
@@ -43,7 +43,7 @@ import org.springframework.util.ObjectUtils;
|
||||
* transactional} execution of test methods, etc.
|
||||
* </p>
|
||||
* <p>
|
||||
* Specifically, a <code>TestContextManager</code> is responsible for managing a
|
||||
* Specifically, a {@code TestContextManager} is responsible for managing a
|
||||
* single {@link TestContext} and signaling events to all registered
|
||||
* {@link TestExecutionListener TestExecutionListeners} at well defined test
|
||||
* execution points:
|
||||
@@ -54,10 +54,10 @@ import org.springframework.util.ObjectUtils;
|
||||
* 4's {@link org.junit.BeforeClass @BeforeClass})</li>
|
||||
* <li>{@link #prepareTestInstance(Object) test instance preparation}:
|
||||
* immediately following instantiation of the test instance</li>
|
||||
* <li>{@link #beforeTestMethod(Object,Method) before test method execution}:
|
||||
* <li>{@link #beforeTestMethod(Object, Method) before test method execution}:
|
||||
* prior to any <em>before methods</em> of a particular testing framework (e.g.,
|
||||
* JUnit 4's {@link org.junit.Before @Before})</li>
|
||||
* <li>{@link #afterTestMethod(Object,Method,Throwable) after test method
|
||||
* <li>{@link #afterTestMethod(Object, Method, Throwable) after test method
|
||||
* execution}: after any <em>after methods</em> of a particular testing
|
||||
* framework (e.g., JUnit 4's {@link org.junit.After @After})</li>
|
||||
* <li>{@link #afterTestClass() after test class execution}: after any
|
||||
@@ -97,20 +97,20 @@ public class TestContextManager {
|
||||
|
||||
/**
|
||||
* Delegates to {@link #TestContextManager(Class, String)} with a value of
|
||||
* <code>null</code> for the default <code>ContextLoader</code> class name.
|
||||
* {@code null} for the default {@code ContextLoader} class name.
|
||||
*/
|
||||
public TestContextManager(Class<?> testClass) {
|
||||
this(testClass, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <code>TestContextManager</code> for the specified {@link Class test class}
|
||||
* Constructs a new {@code TestContextManager} for the specified {@link Class test class}
|
||||
* and automatically {@link #registerTestExecutionListeners registers} the
|
||||
* {@link TestExecutionListener TestExecutionListeners} configured for the test class
|
||||
* via the {@link TestExecutionListeners @TestExecutionListeners} annotation.
|
||||
* @param testClass the test class to be managed
|
||||
* @param defaultContextLoaderClassName the name of the default
|
||||
* <code>ContextLoader</code> class to use (may be <code>null</code>)
|
||||
* {@code ContextLoader} class to use (may be {@code null})
|
||||
* @see #registerTestExecutionListeners(TestExecutionListener...)
|
||||
* @see #retrieveTestExecutionListeners(Class)
|
||||
*/
|
||||
@@ -121,7 +121,7 @@ public class TestContextManager {
|
||||
|
||||
/**
|
||||
* Returns the {@link TestContext} managed by this
|
||||
* <code>TestContextManager</code>.
|
||||
* {@code TestContextManager}.
|
||||
*/
|
||||
protected final TestContext getTestContext() {
|
||||
return this.testContext;
|
||||
@@ -129,7 +129,7 @@ public class TestContextManager {
|
||||
|
||||
/**
|
||||
* Register the supplied {@link TestExecutionListener TestExecutionListeners}
|
||||
* by appending them to the set of listeners used by this <code>TestContextManager</code>.
|
||||
* by appending them to the set of listeners used by this {@code TestContextManager}.
|
||||
*/
|
||||
public void registerTestExecutionListeners(TestExecutionListener... testExecutionListeners) {
|
||||
for (TestExecutionListener listener : testExecutionListeners) {
|
||||
@@ -142,7 +142,7 @@ public class TestContextManager {
|
||||
|
||||
/**
|
||||
* Get the current {@link TestExecutionListener TestExecutionListeners}
|
||||
* registered for this <code>TestContextManager</code>.
|
||||
* registered for this {@code TestContextManager}.
|
||||
* <p>Allows for modifications, e.g. adding a listener to the beginning of the list.
|
||||
* However, make sure to keep the list stable while actually executing tests.
|
||||
*/
|
||||
@@ -152,7 +152,7 @@ public class TestContextManager {
|
||||
|
||||
/**
|
||||
* Get a copy of the {@link TestExecutionListener TestExecutionListeners}
|
||||
* registered for this <code>TestContextManager</code> in reverse order.
|
||||
* registered for this {@code TestContextManager} in reverse order.
|
||||
*/
|
||||
private List<TestExecutionListener> getReversedTestExecutionListeners() {
|
||||
List<TestExecutionListener> listenersReversed = new ArrayList<TestExecutionListener>(
|
||||
@@ -167,7 +167,7 @@ public class TestContextManager {
|
||||
* is not <em>present</em> on the supplied class, the default listeners will be returned.
|
||||
* <p>Note that the {@link TestExecutionListeners#inheritListeners() inheritListeners} flag of
|
||||
* {@link TestExecutionListeners @TestExecutionListeners} will be taken into consideration.
|
||||
* Specifically, if the <code>inheritListeners</code> flag is set to <code>true</code>, listeners
|
||||
* Specifically, if the {@code inheritListeners} flag is set to {@code true}, listeners
|
||||
* defined in the annotated class will be appended to the listeners defined in superclasses.
|
||||
* @param clazz the test class for which the listeners should be retrieved
|
||||
* @return an array of TestExecutionListeners for the specified class
|
||||
@@ -292,12 +292,12 @@ public class TestContextManager {
|
||||
* test methods, for example for injecting dependencies, etc. Should be
|
||||
* called immediately after instantiation of the test instance.
|
||||
* <p>The managed {@link TestContext} will be updated with the supplied
|
||||
* <code>testInstance</code>.
|
||||
* {@code testInstance}.
|
||||
* <p>An attempt will be made to give each registered
|
||||
* {@link TestExecutionListener} a chance to prepare the test instance. If a
|
||||
* listener throws an exception, however, the remaining registered listeners
|
||||
* will <strong>not</strong> be called.
|
||||
* @param testInstance the test instance to prepare (never <code>null</code>)
|
||||
* @param testInstance the test instance to prepare (never {@code null})
|
||||
* @throws Exception if a registered TestExecutionListener throws an exception
|
||||
* @see #getTestExecutionListeners()
|
||||
*/
|
||||
@@ -326,12 +326,12 @@ public class TestContextManager {
|
||||
* framework-specific <em>before methods</em> (e.g., methods annotated with
|
||||
* JUnit's {@link org.junit.Before @Before}).
|
||||
* <p>The managed {@link TestContext} will be updated with the supplied
|
||||
* <code>testInstance</code> and <code>testMethod</code>.
|
||||
* {@code testInstance} and {@code testMethod}.
|
||||
* <p>An attempt will be made to give each registered
|
||||
* {@link TestExecutionListener} a chance to pre-process the test method
|
||||
* execution. If a listener throws an exception, however, the remaining
|
||||
* registered listeners will <strong>not</strong> be called.
|
||||
* @param testInstance the current test instance (never <code>null</code>)
|
||||
* @param testInstance the current test instance (never {@code null})
|
||||
* @param testMethod the test method which is about to be executed on the
|
||||
* test instance
|
||||
* @throws Exception if a registered TestExecutionListener throws an exception
|
||||
@@ -363,19 +363,19 @@ public class TestContextManager {
|
||||
* <em>after methods</em> (e.g., methods annotated with JUnit's
|
||||
* {@link org.junit.After @After}).
|
||||
* <p>The managed {@link TestContext} will be updated with the supplied
|
||||
* <code>testInstance</code>, <code>testMethod</code>, and
|
||||
* <code>exception</code>.
|
||||
* {@code testInstance}, {@code testMethod}, and
|
||||
* {@code exception}.
|
||||
* <p>Each registered {@link TestExecutionListener} will be given a chance to
|
||||
* post-process the test method execution. If a listener throws an
|
||||
* exception, the remaining registered listeners will still be called, but
|
||||
* the first exception thrown will be tracked and rethrown after all
|
||||
* listeners have executed. Note that registered listeners will be executed
|
||||
* in the opposite order in which they were registered.
|
||||
* @param testInstance the current test instance (never <code>null</code>)
|
||||
* @param testInstance the current test instance (never {@code null})
|
||||
* @param testMethod the test method which has just been executed on the
|
||||
* test instance
|
||||
* @param exception the exception that was thrown during execution of the
|
||||
* test method or by a TestExecutionListener, or <code>null</code> if none
|
||||
* test method or by a TestExecutionListener, or {@code null} if none
|
||||
* was thrown
|
||||
* @throws Exception if a registered TestExecutionListener throws an exception
|
||||
* @see #getTestExecutionListeners()
|
||||
|
||||
@@ -18,12 +18,12 @@ package org.springframework.test.context;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* <code>TestExecutionListener</code> defines a <em>listener</em> API for
|
||||
* {@code TestExecutionListener} defines a <em>listener</em> API for
|
||||
* reacting to test execution events published by the {@link TestContextManager}
|
||||
* with which the listener is registered.
|
||||
* </p>
|
||||
* <p>
|
||||
* Concrete implementations must provide a <code>public</code> no-args
|
||||
* Concrete implementations must provide a {@code public} no-args
|
||||
* constructor, so that listeners can be instantiated transparently by tools and
|
||||
* configuration mechanisms.
|
||||
* </p>
|
||||
@@ -59,7 +59,7 @@ public interface TestExecutionListener {
|
||||
* <em>before class</em> lifecycle callbacks, this method will not be called
|
||||
* for that framework.
|
||||
*
|
||||
* @param testContext the test context for the test; never <code>null</code>
|
||||
* @param testContext the test context for the test; never {@code null}
|
||||
* @throws Exception allows any exception to propagate
|
||||
*/
|
||||
void beforeTestClass(TestContext testContext) throws Exception;
|
||||
@@ -71,7 +71,7 @@ public interface TestExecutionListener {
|
||||
* This method should be called immediately after instantiation of the test
|
||||
* instance but prior to any framework-specific lifecycle callbacks.
|
||||
*
|
||||
* @param testContext the test context for the test; never <code>null</code>
|
||||
* @param testContext the test context for the test; never {@code null}
|
||||
* @throws Exception allows any exception to propagate
|
||||
*/
|
||||
void prepareTestInstance(TestContext testContext) throws Exception;
|
||||
@@ -86,7 +86,7 @@ public interface TestExecutionListener {
|
||||
* <em>before</em> lifecycle callbacks.
|
||||
*
|
||||
* @param testContext the test context in which the test method will be
|
||||
* executed; never <code>null</code>
|
||||
* executed; never {@code null}
|
||||
* @throws Exception allows any exception to propagate
|
||||
*/
|
||||
void beforeTestMethod(TestContext testContext) throws Exception;
|
||||
@@ -101,7 +101,7 @@ public interface TestExecutionListener {
|
||||
* <em>after</em> lifecycle callbacks.
|
||||
*
|
||||
* @param testContext the test context in which the test method was
|
||||
* executed; never <code>null</code>
|
||||
* executed; never {@code null}
|
||||
* @throws Exception allows any exception to propagate
|
||||
*/
|
||||
void afterTestMethod(TestContext testContext) throws Exception;
|
||||
@@ -117,7 +117,7 @@ public interface TestExecutionListener {
|
||||
* <em>after class</em> lifecycle callbacks, this method will not be called
|
||||
* for that framework.
|
||||
*
|
||||
* @param testContext the test context for the test; never <code>null</code>
|
||||
* @param testContext the test context for the test; never {@code null}
|
||||
* @throws Exception allows any exception to propagate
|
||||
*/
|
||||
void afterTestClass(TestContext testContext) throws Exception;
|
||||
|
||||
@@ -24,10 +24,10 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* <code>TestExecutionListeners</code> defines class-level metadata for
|
||||
* {@code TestExecutionListeners} defines class-level metadata for
|
||||
* configuring which {@link TestExecutionListener TestExecutionListeners} should
|
||||
* be registered with a {@link TestContextManager}. Typically,
|
||||
* <code>@TestExecutionListeners</code> will be used in conjunction with
|
||||
* {@code @TestExecutionListeners} will be used in conjunction with
|
||||
* {@link ContextConfiguration @ContextConfiguration}.
|
||||
*
|
||||
* @author Sam Brannen
|
||||
@@ -65,23 +65,23 @@ public @interface TestExecutionListeners {
|
||||
* should be <em>inherited</em>.
|
||||
* </p>
|
||||
* <p>
|
||||
* The default value is <code>true</code>, which means that an annotated
|
||||
* The default value is {@code true}, which means that an annotated
|
||||
* class will <em>inherit</em> the listeners defined by an annotated
|
||||
* superclass. Specifically, the listeners for an annotated class will be
|
||||
* appended to the list of listeners defined by an annotated superclass.
|
||||
* Thus, subclasses have the option of <em>extending</em> the list of
|
||||
* listeners. In the following example, <code>AbstractBaseTest</code> will
|
||||
* be configured with <code>DependencyInjectionTestExecutionListener</code>
|
||||
* and <code>DirtiesContextTestExecutionListener</code>; whereas,
|
||||
* <code>TransactionalTest</code> will be configured with
|
||||
* <code>DependencyInjectionTestExecutionListener</code>,
|
||||
* <code>DirtiesContextTestExecutionListener</code>, <strong>and</strong>
|
||||
* <code>TransactionalTestExecutionListener</code>, in that order.
|
||||
* listeners. In the following example, {@code AbstractBaseTest} will
|
||||
* be configured with {@code DependencyInjectionTestExecutionListener}
|
||||
* and {@code DirtiesContextTestExecutionListener}; whereas,
|
||||
* {@code TransactionalTest} will be configured with
|
||||
* {@code DependencyInjectionTestExecutionListener},
|
||||
* {@code DirtiesContextTestExecutionListener}, <strong>and</strong>
|
||||
* {@code TransactionalTestExecutionListener}, in that order.
|
||||
* </p>
|
||||
*
|
||||
* <pre class="code">
|
||||
* @TestExecutionListeners({ DependencyInjectionTestExecutionListener.class,
|
||||
* DirtiesContextTestExecutionListener.class })
|
||||
* DirtiesContextTestExecutionListener.class })
|
||||
* public abstract class AbstractBaseTest {
|
||||
* // ...
|
||||
* }
|
||||
@@ -91,9 +91,9 @@ public @interface TestExecutionListeners {
|
||||
* // ...
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* If <code>inheritListeners</code> is set to <code>false</code>, the
|
||||
* If {@code inheritListeners} is set to {@code false}, the
|
||||
* listeners for the annotated class will <em>shadow</em> and effectively
|
||||
* replace any listeners defined by a superclass.
|
||||
* </p>
|
||||
|
||||
@@ -63,11 +63,11 @@ import org.springframework.test.context.support.DirtiesContextTestExecutionListe
|
||||
* AbstractJUnit38SpringContextTests()} and
|
||||
* {@link #AbstractJUnit38SpringContextTests(String)
|
||||
* AbstractJUnit38SpringContextTests(String)} and delegate to
|
||||
* <code>super();</code> and <code>super(name);</code> respectively.</li>
|
||||
* {@code super();} and {@code super(name);} respectively.</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* The following list constitutes all annotations currently supported directly
|
||||
* by <code>AbstractJUnit38SpringContextTests</code>. <i>(Note that additional
|
||||
* by {@code AbstractJUnit38SpringContextTests}. <i>(Note that additional
|
||||
* annotations may be supported by various
|
||||
* {@link org.springframework.test.context.TestExecutionListener
|
||||
* TestExecutionListeners})</i>
|
||||
@@ -161,7 +161,7 @@ public abstract class AbstractJUnit38SpringContextTests extends TestCase impleme
|
||||
|
||||
/**
|
||||
* Constructs a new AbstractJUnit38SpringContextTests instance with the
|
||||
* supplied <code>name</code>; initializes the internal
|
||||
* supplied {@code name}; initializes the internal
|
||||
* {@link TestContextManager} for the current test; and retrieves the
|
||||
* configured (or default) {@link ProfileValueSource}.
|
||||
*
|
||||
@@ -245,7 +245,7 @@ public abstract class AbstractJUnit38SpringContextTests extends TestCase impleme
|
||||
*
|
||||
* @param tec the test execution callback to run
|
||||
* @param testMethod the actual test method: used to retrieve the
|
||||
* <code>timeout</code>
|
||||
* {@code timeout}
|
||||
* @throws Throwable if any exception is thrown
|
||||
* @see Timed
|
||||
* @see #runTest
|
||||
|
||||
@@ -91,7 +91,7 @@ public abstract class AbstractTransactionalJUnit38SpringContextTests extends Abs
|
||||
|
||||
/**
|
||||
* Constructs a new AbstractTransactionalJUnit38SpringContextTests instance
|
||||
* with the supplied <code>name</code>.
|
||||
* with the supplied {@code name}.
|
||||
* @param name the name of the current test to execute
|
||||
*/
|
||||
public AbstractTransactionalJUnit38SpringContextTests(String name) {
|
||||
@@ -145,7 +145,7 @@ public abstract class AbstractTransactionalJUnit38SpringContextTests extends Abs
|
||||
* @param continueOnError whether or not to continue without throwing an
|
||||
* exception in the event of an error
|
||||
* @throws DataAccessException if there is an error executing a statement
|
||||
* and continueOnError was <code>false</code>
|
||||
* and continueOnError was {@code false}
|
||||
*/
|
||||
protected void executeSqlScript(String sqlResourcePath, boolean continueOnError)
|
||||
throws DataAccessException {
|
||||
|
||||
@@ -164,7 +164,7 @@ public abstract class AbstractTransactionalJUnit4SpringContextTests extends Abst
|
||||
* @param continueOnError whether or not to continue without throwing an
|
||||
* exception in the event of an error
|
||||
* @throws DataAccessException if there is an error executing a statement
|
||||
* and continueOnError was <code>false</code>
|
||||
* and continueOnError was {@code false}
|
||||
*/
|
||||
protected void executeSqlScript(String sqlResourcePath, boolean continueOnError) throws DataAccessException {
|
||||
Resource resource = this.applicationContext.getResource(sqlResourcePath);
|
||||
|
||||
@@ -49,7 +49,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* <code>SpringJUnit4ClassRunner</code> is a custom extension of
|
||||
* {@code SpringJUnit4ClassRunner} is a custom extension of
|
||||
* {@link BlockJUnit4ClassRunner} which provides functionality of the
|
||||
* <em>Spring TestContext Framework</em> to standard JUnit 4.5+ tests by means
|
||||
* of the {@link TestContextManager} and associated support classes and
|
||||
@@ -57,7 +57,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
* </p>
|
||||
* <p>
|
||||
* The following list constitutes all annotations currently supported directly
|
||||
* by <code>SpringJUnit4ClassRunner</code>.
|
||||
* by {@code SpringJUnit4ClassRunner}.
|
||||
* <em>(Note that additional annotations may be supported by various
|
||||
* {@link org.springframework.test.context.TestExecutionListener
|
||||
* TestExecutionListeners})</em>
|
||||
@@ -76,7 +76,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
* @IfProfileValue}</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* <b>NOTE:</b> As of Spring 3.0, <code>SpringJUnit4ClassRunner</code> requires
|
||||
* <b>NOTE:</b> As of Spring 3.0, {@code SpringJUnit4ClassRunner} requires
|
||||
* JUnit 4.5+.
|
||||
* </p>
|
||||
*
|
||||
@@ -94,7 +94,7 @@ public class SpringJUnit4ClassRunner extends BlockJUnit4ClassRunner {
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new <code>SpringJUnit4ClassRunner</code> and initializes a
|
||||
* Constructs a new {@code SpringJUnit4ClassRunner} and initializes a
|
||||
* {@link TestContextManager} to provide Spring testing functionality to
|
||||
* standard JUnit tests.
|
||||
* @param clazz the test class to be run
|
||||
@@ -110,7 +110,7 @@ public class SpringJUnit4ClassRunner extends BlockJUnit4ClassRunner {
|
||||
|
||||
/**
|
||||
* Creates a new {@link TestContextManager} for the supplied test class and
|
||||
* the configured <em>default <code>ContextLoader</code> class name</em>.
|
||||
* the configured <em>default {@code ContextLoader} class name</em>.
|
||||
* Can be overridden by subclasses.
|
||||
* @param clazz the test class to be managed
|
||||
* @see #getDefaultContextLoaderClassName(Class)
|
||||
@@ -127,15 +127,15 @@ public class SpringJUnit4ClassRunner extends BlockJUnit4ClassRunner {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the default <code>ContextLoader</code> class to use for
|
||||
* Get the name of the default {@code ContextLoader} class to use for
|
||||
* the supplied test class. The named class will be used if the test class
|
||||
* does not explicitly declare a <code>ContextLoader</code> class via the
|
||||
* <code>@ContextConfiguration</code> annotation.
|
||||
* <p>The default implementation returns <code>null</code>, thus implying use
|
||||
* of the <em>standard</em> default <code>ContextLoader</code> class name.
|
||||
* does not explicitly declare a {@code ContextLoader} class via the
|
||||
* {@code @ContextConfiguration} annotation.
|
||||
* <p>The default implementation returns {@code null}, thus implying use
|
||||
* of the <em>standard</em> default {@code ContextLoader} class name.
|
||||
* Can be overridden by subclasses.
|
||||
* @param clazz the test class
|
||||
* @return <code>null</code>
|
||||
* @return {@code null}
|
||||
*/
|
||||
protected String getDefaultContextLoaderClassName(Class<?> clazz) {
|
||||
return null;
|
||||
@@ -143,7 +143,7 @@ public class SpringJUnit4ClassRunner extends BlockJUnit4ClassRunner {
|
||||
|
||||
/**
|
||||
* Returns a description suitable for an ignored test class if the test is
|
||||
* disabled via <code>@IfProfileValue</code> at the class-level, and
|
||||
* disabled via {@code @IfProfileValue} at the class-level, and
|
||||
* otherwise delegates to the parent implementation.
|
||||
* @see ProfileValueUtils#isTestEnabledInThisEnvironment(Class)
|
||||
*/
|
||||
@@ -157,9 +157,9 @@ public class SpringJUnit4ClassRunner extends BlockJUnit4ClassRunner {
|
||||
|
||||
/**
|
||||
* Check whether the test is enabled in the first place. This prevents
|
||||
* classes with a non-matching <code>@IfProfileValue</code> annotation
|
||||
* classes with a non-matching {@code @IfProfileValue} annotation
|
||||
* from running altogether, even skipping the execution of
|
||||
* <code>prepareTestInstance()</code> <code>TestExecutionListener</code>
|
||||
* {@code prepareTestInstance()} {@code TestExecutionListener}
|
||||
* methods.
|
||||
* @see ProfileValueUtils#isTestEnabledInThisEnvironment(Class)
|
||||
* @see org.springframework.test.annotation.IfProfileValue
|
||||
@@ -242,10 +242,10 @@ public class SpringJUnit4ClassRunner extends BlockJUnit4ClassRunner {
|
||||
}
|
||||
|
||||
/**
|
||||
* <code>springMakeNotifier()</code> is an exact copy of
|
||||
* {@code springMakeNotifier()} is an exact copy of
|
||||
* {@link BlockJUnit4ClassRunner BlockJUnit4ClassRunner's}
|
||||
* <code>makeNotifier()</code> method, but we have decided to prefix it with
|
||||
* "spring" and keep it <code>private</code> in order to avoid the
|
||||
* {@code makeNotifier()} method, but we have decided to prefix it with
|
||||
* "spring" and keep it {@code private} in order to avoid the
|
||||
* compatibility clashes that were introduced in JUnit between versions 4.5,
|
||||
* 4.6, and 4.7.
|
||||
*/
|
||||
@@ -262,10 +262,10 @@ public class SpringJUnit4ClassRunner extends BlockJUnit4ClassRunner {
|
||||
* in order to include execution of {@link org.junit.Before @Before}
|
||||
* and {@link org.junit.After @After} methods within the timed
|
||||
* execution. Note that this differs from the default JUnit behavior of
|
||||
* executing <code>@Before</code> and <code>@After</code> methods
|
||||
* executing {@code @Before} and {@code @After} methods
|
||||
* in the main thread while executing the actual test method in a separate
|
||||
* thread. Thus, the end effect is that <code>@Before</code> and
|
||||
* <code>@After</code> methods will be executed in the same thread as
|
||||
* thread. Thus, the end effect is that {@code @Before} and
|
||||
* {@code @After} methods will be executed in the same thread as
|
||||
* the test method. As a consequence, JUnit-specified timeouts will work
|
||||
* fine in combination with Spring transactions. Note that JUnit-specific
|
||||
* timeouts still differ from Spring-specific timeouts in that the former
|
||||
@@ -305,7 +305,7 @@ public class SpringJUnit4ClassRunner extends BlockJUnit4ClassRunner {
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes JUnit 4.7's private <code>withRules()</code> method using
|
||||
* Invokes JUnit 4.7's private {@code withRules()} method using
|
||||
* reflection. This is necessary for backwards compatibility with the JUnit
|
||||
* 4.5 and 4.6 implementations of {@link BlockJUnit4ClassRunner}.
|
||||
*/
|
||||
@@ -323,9 +323,9 @@ public class SpringJUnit4ClassRunner extends BlockJUnit4ClassRunner {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if {@link Ignore @Ignore} is present for
|
||||
* Returns {@code true} if {@link Ignore @Ignore} is present for
|
||||
* the supplied {@link FrameworkMethod test method} or if the test method is
|
||||
* disabled via <code>@IfProfileValue</code>.
|
||||
* disabled via {@code @IfProfileValue}.
|
||||
* @see ProfileValueUtils#isTestEnabledInThisEnvironment(Method, Class)
|
||||
*/
|
||||
protected boolean isTestMethodIgnored(FrameworkMethod frameworkMethod) {
|
||||
@@ -347,12 +347,12 @@ public class SpringJUnit4ClassRunner extends BlockJUnit4ClassRunner {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the <code>exception</code> that the supplied {@link FrameworkMethod
|
||||
* Get the {@code exception} that the supplied {@link FrameworkMethod
|
||||
* test method} is expected to throw.
|
||||
* <p>Supports both Spring's {@link ExpectedException @ExpectedException(...)}
|
||||
* and JUnit's {@link Test#expected() @Test(expected=...)} annotations, but
|
||||
* not both simultaneously.
|
||||
* @return the expected exception, or <code>null</code> if none was specified
|
||||
* @return the expected exception, or {@code null} if none was specified
|
||||
*/
|
||||
protected Class<? extends Throwable> getExpectedException(FrameworkMethod frameworkMethod) {
|
||||
Test testAnnotation = frameworkMethod.getAnnotation(Test.class);
|
||||
@@ -411,9 +411,9 @@ public class SpringJUnit4ClassRunner extends BlockJUnit4ClassRunner {
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the configured JUnit <code>timeout</code> from the {@link Test
|
||||
* Retrieves the configured JUnit {@code timeout} from the {@link Test
|
||||
* @Test} annotation on the supplied {@link FrameworkMethod test method}.
|
||||
* @return the timeout, or <code>0</code> if none was specified.
|
||||
* @return the timeout, or {@code 0} if none was specified.
|
||||
*/
|
||||
protected long getJUnitTimeout(FrameworkMethod frameworkMethod) {
|
||||
Test testAnnotation = frameworkMethod.getAnnotation(Test.class);
|
||||
@@ -421,10 +421,10 @@ public class SpringJUnit4ClassRunner extends BlockJUnit4ClassRunner {
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the configured Spring-specific <code>timeout</code> from the
|
||||
* Retrieves the configured Spring-specific {@code timeout} from the
|
||||
* {@link Timed @Timed} annotation on the supplied
|
||||
* {@link FrameworkMethod test method}.
|
||||
* @return the timeout, or <code>0</code> if none was specified.
|
||||
* @return the timeout, or {@code 0} if none was specified.
|
||||
*/
|
||||
protected long getSpringTimeout(FrameworkMethod frameworkMethod) {
|
||||
Timed timedAnnotation = frameworkMethod.getAnnotation(Timed.class);
|
||||
@@ -462,7 +462,7 @@ public class SpringJUnit4ClassRunner extends BlockJUnit4ClassRunner {
|
||||
/**
|
||||
* Supports Spring's {@link Repeat @Repeat} annotation by returning a
|
||||
* {@link SpringRepeat} statement initialized with the configured repeat
|
||||
* count or <code>1</code> if no repeat count is configured.
|
||||
* count or {@code 1} if no repeat count is configured.
|
||||
* @see SpringRepeat
|
||||
*/
|
||||
protected Statement withPotentialRepeat(FrameworkMethod frameworkMethod, Object testInstance, Statement next) {
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.junit.runners.model.Statement;
|
||||
import org.springframework.test.context.TestContextManager;
|
||||
|
||||
/**
|
||||
* <code>RunAfterTestClassCallbacks</code> is a custom JUnit 4.5+
|
||||
* {@code RunAfterTestClassCallbacks} is a custom JUnit 4.5+
|
||||
* {@link Statement} which allows the <em>Spring TestContext Framework</em> to
|
||||
* be plugged into the JUnit execution chain by calling
|
||||
* {@link TestContextManager#afterTestClass() afterTestClass()} on the supplied
|
||||
@@ -44,11 +44,11 @@ public class RunAfterTestClassCallbacks extends Statement {
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new <code>RunAfterTestClassCallbacks</code> statement.
|
||||
* Constructs a new {@code RunAfterTestClassCallbacks} statement.
|
||||
*
|
||||
* @param next the next <code>Statement</code> in the execution chain
|
||||
* @param next the next {@code Statement} in the execution chain
|
||||
* @param testContextManager the TestContextManager upon which to call
|
||||
* <code>afterTestClass()</code>
|
||||
* {@code afterTestClass()}
|
||||
*/
|
||||
public RunAfterTestClassCallbacks(Statement next, TestContextManager testContextManager) {
|
||||
this.next = next;
|
||||
@@ -60,7 +60,7 @@ public class RunAfterTestClassCallbacks extends Statement {
|
||||
* instance of {@link org.junit.internal.runners.statements.RunAfters
|
||||
* RunAfters}), catching any exceptions thrown, and then calls
|
||||
* {@link TestContextManager#afterTestClass()}. If the call to
|
||||
* <code>afterTestClass()</code> throws an exception, it will also be
|
||||
* {@code afterTestClass()} throws an exception, it will also be
|
||||
* tracked. Multiple exceptions will be combined into a
|
||||
* {@link MultipleFailureException}.
|
||||
*/
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.junit.runners.model.Statement;
|
||||
import org.springframework.test.context.TestContextManager;
|
||||
|
||||
/**
|
||||
* <code>RunAfterTestMethodCallbacks</code> is a custom JUnit 4.5+
|
||||
* {@code RunAfterTestMethodCallbacks} is a custom JUnit 4.5+
|
||||
* {@link Statement} which allows the <em>Spring TestContext Framework</em> to
|
||||
* be plugged into the JUnit execution chain by calling
|
||||
* {@link TestContextManager#afterTestMethod(Object, Method, Throwable) afterTestMethod()}
|
||||
@@ -49,14 +49,14 @@ public class RunAfterTestMethodCallbacks extends Statement {
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new <code>RunAfterTestMethodCallbacks</code> statement.
|
||||
* Constructs a new {@code RunAfterTestMethodCallbacks} statement.
|
||||
*
|
||||
* @param next the next <code>Statement</code> in the execution chain
|
||||
* @param testInstance the current test instance (never <code>null</code>)
|
||||
* @param next the next {@code Statement} in the execution chain
|
||||
* @param testInstance the current test instance (never {@code null})
|
||||
* @param testMethod the test method which has just been executed on the
|
||||
* test instance
|
||||
* @param testContextManager the TestContextManager upon which to call
|
||||
* <code>afterTestMethod()</code>
|
||||
* {@code afterTestMethod()}
|
||||
*/
|
||||
public RunAfterTestMethodCallbacks(Statement next, Object testInstance, Method testMethod,
|
||||
TestContextManager testContextManager) {
|
||||
@@ -71,7 +71,7 @@ public class RunAfterTestMethodCallbacks extends Statement {
|
||||
* instance of {@link org.junit.internal.runners.statements.RunAfters
|
||||
* RunAfters}), catching any exceptions thrown, and then calls
|
||||
* {@link TestContextManager#afterTestMethod(Object, Method, Throwable)} with the first
|
||||
* caught exception (if any). If the call to <code>afterTestMethod()</code>
|
||||
* caught exception (if any). If the call to {@code afterTestMethod()}
|
||||
* throws an exception, it will also be tracked. Multiple exceptions will be
|
||||
* combined into a {@link MultipleFailureException}.
|
||||
*/
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.junit.runners.model.Statement;
|
||||
import org.springframework.test.context.TestContextManager;
|
||||
|
||||
/**
|
||||
* <code>RunBeforeTestClassCallbacks</code> is a custom JUnit 4.5+
|
||||
* {@code RunBeforeTestClassCallbacks} is a custom JUnit 4.5+
|
||||
* {@link Statement} which allows the <em>Spring TestContext Framework</em> to
|
||||
* be plugged into the JUnit execution chain by calling
|
||||
* {@link TestContextManager#beforeTestClass() beforeTestClass()} on the
|
||||
@@ -39,11 +39,11 @@ public class RunBeforeTestClassCallbacks extends Statement {
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new <code>RunBeforeTestClassCallbacks</code> statement.
|
||||
* Constructs a new {@code RunBeforeTestClassCallbacks} statement.
|
||||
*
|
||||
* @param next the next <code>Statement</code> in the execution chain
|
||||
* @param next the next {@code Statement} in the execution chain
|
||||
* @param testContextManager the TestContextManager upon which to call
|
||||
* <code>beforeTestClass()</code>
|
||||
* {@code beforeTestClass()}
|
||||
*/
|
||||
public RunBeforeTestClassCallbacks(Statement next, TestContextManager testContextManager) {
|
||||
this.next = next;
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.junit.runners.model.Statement;
|
||||
import org.springframework.test.context.TestContextManager;
|
||||
|
||||
/**
|
||||
* <code>RunBeforeTestMethodCallbacks</code> is a custom JUnit 4.5+
|
||||
* {@code RunBeforeTestMethodCallbacks} is a custom JUnit 4.5+
|
||||
* {@link Statement} which allows the <em>Spring TestContext Framework</em> to
|
||||
* be plugged into the JUnit execution chain by calling
|
||||
* {@link TestContextManager#beforeTestMethod(Object, Method)
|
||||
@@ -45,14 +45,14 @@ public class RunBeforeTestMethodCallbacks extends Statement {
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new <code>RunBeforeTestMethodCallbacks</code> statement.
|
||||
* Constructs a new {@code RunBeforeTestMethodCallbacks} statement.
|
||||
*
|
||||
* @param next the next <code>Statement</code> in the execution chain
|
||||
* @param testInstance the current test instance (never <code>null</code>)
|
||||
* @param next the next {@code Statement} in the execution chain
|
||||
* @param testInstance the current test instance (never {@code null})
|
||||
* @param testMethod the test method which is about to be executed on the
|
||||
* test instance
|
||||
* @param testContextManager the TestContextManager upon which to call
|
||||
* <code>beforeTestMethod()</code>
|
||||
* {@code beforeTestMethod()}
|
||||
*/
|
||||
public RunBeforeTestMethodCallbacks(Statement next, Object testInstance, Method testMethod,
|
||||
TestContextManager testContextManager) {
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.junit.runners.model.Statement;
|
||||
import org.springframework.test.annotation.Timed;
|
||||
|
||||
/**
|
||||
* <code>SpringFailOnTimeout</code> is a custom JUnit 4.5+ {@link Statement}
|
||||
* {@code SpringFailOnTimeout} is a custom JUnit 4.5+ {@link Statement}
|
||||
* which adds support for Spring's {@link Timed @Timed} annotation by throwing
|
||||
* an exception if the next statement in the execution chain takes more than the
|
||||
* specified number of milliseconds.
|
||||
@@ -39,10 +39,10 @@ public class SpringFailOnTimeout extends Statement {
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new <code>SpringFailOnTimeout</code> statement.
|
||||
* Constructs a new {@code SpringFailOnTimeout} statement.
|
||||
*
|
||||
* @param next the next <code>Statement</code> in the execution chain
|
||||
* @param timeout the configured <code>timeout</code> for the current test
|
||||
* @param next the next {@code Statement} in the execution chain
|
||||
* @param timeout the configured {@code timeout} for the current test
|
||||
* @see Timed#millis()
|
||||
*/
|
||||
public SpringFailOnTimeout(Statement next, long timeout) {
|
||||
@@ -56,7 +56,7 @@ public class SpringFailOnTimeout extends Statement {
|
||||
* {@link org.junit.internal.runners.statements.InvokeMethod InvokeMethod}
|
||||
* or {@link org.junit.internal.runners.statements.ExpectException
|
||||
* ExpectException}) and throws an exception if the next
|
||||
* <code>statement</code> takes more than the specified <code>timeout</code>
|
||||
* {@code statement} takes more than the specified {@code timeout}
|
||||
* .
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.springframework.test.annotation.Repeat;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* <code>SpringRepeat</code> is a custom JUnit 4.5+ {@link Statement} which adds
|
||||
* {@code SpringRepeat} is a custom JUnit 4.5+ {@link Statement} which adds
|
||||
* support for Spring's {@link Repeat @Repeat} annotation by repeating the
|
||||
* test for the specified number of times.
|
||||
*
|
||||
@@ -45,9 +45,9 @@ public class SpringRepeat extends Statement {
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new <code>SpringRepeat</code> statement.
|
||||
* Constructs a new {@code SpringRepeat} statement.
|
||||
*
|
||||
* @param next the next <code>Statement</code> in the execution chain
|
||||
* @param next the next {@code Statement} in the execution chain
|
||||
* @param testMethod the current test method
|
||||
* @param repeat the configured repeat count for the current test method
|
||||
* @see Repeat#value()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>JUnit 4.5 based <code>statements</code> used in the <em>Spring TestContext Framework</em>.</p>
|
||||
* <p>JUnit 4.5 based {@code statements} used in the <em>Spring TestContext Framework</em>.</p>
|
||||
*
|
||||
*/
|
||||
package org.springframework.test.context.junit4.statements;
|
||||
|
||||
@@ -47,7 +47,7 @@ import org.springframework.util.StringUtils;
|
||||
* <em>Template Method</em> based approach for {@link #processLocations processing}
|
||||
* resource locations.
|
||||
*
|
||||
* <p>As of Spring 3.1, <code>AbstractContextLoader</code> also provides a basis
|
||||
* <p>As of Spring 3.1, {@code AbstractContextLoader} also provides a basis
|
||||
* for all concrete implementations of the {@link SmartContextLoader} SPI. For
|
||||
* backwards compatibility with the {@code ContextLoader} SPI,
|
||||
* {@link #processContextConfiguration(ContextConfigurationAttributes)} delegates
|
||||
@@ -99,7 +99,7 @@ public abstract class AbstractContextLoader implements SmartContextLoader {
|
||||
* <p>The default implementation:
|
||||
* <ul>
|
||||
* <li>Sets the <em>active bean definition profiles</em> from the supplied
|
||||
* <code>MergedContextConfiguration</code> in the
|
||||
* {@code MergedContextConfiguration} in the
|
||||
* {@link org.springframework.core.env.Environment Environment} of the context.</li>
|
||||
* <li>Determines what (if any) context initializer classes have been supplied
|
||||
* via the {@code MergedContextConfiguration} and
|
||||
@@ -153,19 +153,19 @@ public abstract class AbstractContextLoader implements SmartContextLoader {
|
||||
// --- ContextLoader -------------------------------------------------------
|
||||
|
||||
/**
|
||||
* If the supplied <code>locations</code> are <code>null</code> or
|
||||
* If the supplied {@code locations} are {@code null} or
|
||||
* <em>empty</em> and {@link #isGenerateDefaultLocations()} returns
|
||||
* <code>true</code>, default locations will be
|
||||
* {@code true}, default locations will be
|
||||
* {@link #generateDefaultLocations(Class) generated} for the specified
|
||||
* {@link Class class} and the configured
|
||||
* {@link #getResourceSuffix() resource suffix}; otherwise, the supplied
|
||||
* <code>locations</code> will be {@link #modifyLocations modified} if
|
||||
* {@code locations} will be {@link #modifyLocations modified} if
|
||||
* necessary and returned.
|
||||
*
|
||||
* @param clazz the class with which the locations are associated: to be
|
||||
* used when generating default locations
|
||||
* @param locations the unmodified locations to use for loading the
|
||||
* application context (can be <code>null</code> or empty)
|
||||
* application context (can be {@code null} or empty)
|
||||
* @return a processed array of application context resource locations
|
||||
* @since 2.5
|
||||
* @see #isGenerateDefaultLocations()
|
||||
@@ -183,10 +183,10 @@ public abstract class AbstractContextLoader implements SmartContextLoader {
|
||||
* Generate the default classpath resource locations array based on the
|
||||
* supplied class.
|
||||
*
|
||||
* <p>For example, if the supplied class is <code>com.example.MyTest</code>,
|
||||
* <p>For example, if the supplied class is {@code com.example.MyTest},
|
||||
* the generated locations will contain a single string with a value of
|
||||
* "classpath:/com/example/MyTest<code><suffix></code>",
|
||||
* where <code><suffix></code> is the value of the
|
||||
* "classpath:/com/example/MyTest{@code <suffix>}",
|
||||
* where {@code <suffix>} is the value of the
|
||||
* {@link #getResourceSuffix() resource suffix} string.
|
||||
*
|
||||
* <p>As of Spring 3.1, the implementation of this method adheres to the
|
||||
@@ -237,7 +237,7 @@ public abstract class AbstractContextLoader implements SmartContextLoader {
|
||||
* "/org/springframework/whatever/foo.xml". A path which
|
||||
* references a URL (e.g., a path prefixed with
|
||||
* {@link ResourceUtils#CLASSPATH_URL_PREFIX classpath:},
|
||||
* {@link ResourceUtils#FILE_URL_PREFIX file:}, <code>http:</code>,
|
||||
* {@link ResourceUtils#FILE_URL_PREFIX file:}, {@code http:},
|
||||
* etc.) will be added to the results unchanged.
|
||||
*
|
||||
* <p>Subclasses can override this method to implement a different
|
||||
@@ -266,21 +266,21 @@ public abstract class AbstractContextLoader implements SmartContextLoader {
|
||||
|
||||
/**
|
||||
* Determine whether or not <em>default</em> resource locations should be
|
||||
* generated if the <code>locations</code> provided to
|
||||
* {@link #processLocations(Class, String...)} are <code>null</code> or empty.
|
||||
* generated if the {@code locations} provided to
|
||||
* {@link #processLocations(Class, String...)} are {@code null} or empty.
|
||||
*
|
||||
* <p>As of Spring 3.1, the semantics of this method have been overloaded
|
||||
* to include detection of either default resource locations or default
|
||||
* configuration classes. Consequently, this method can also be used to
|
||||
* determine whether or not <em>default</em> configuration classes should be
|
||||
* detected if the <code>classes</code> present in the
|
||||
* detected if the {@code classes} present in the
|
||||
* {@link ContextConfigurationAttributes configuration attributes} supplied
|
||||
* to {@link #processContextConfiguration(ContextConfigurationAttributes)}
|
||||
* are <code>null</code> or empty.
|
||||
* are {@code null} or empty.
|
||||
*
|
||||
* <p>Can be overridden by subclasses to change the default behavior.
|
||||
*
|
||||
* @return always <code>true</code> by default
|
||||
* @return always {@code true} by default
|
||||
* @since 2.5
|
||||
*/
|
||||
protected boolean isGenerateDefaultLocations() {
|
||||
@@ -293,7 +293,7 @@ public abstract class AbstractContextLoader implements SmartContextLoader {
|
||||
*
|
||||
* <p>Must be implemented by subclasses.
|
||||
*
|
||||
* @return the resource suffix; should not be <code>null</code> or empty
|
||||
* @return the resource suffix; should not be {@code null} or empty
|
||||
* @since 2.5
|
||||
* @see #generateDefaultLocations(Class)
|
||||
*/
|
||||
|
||||
@@ -134,7 +134,7 @@ public abstract class AbstractDelegatingSmartContextLoader implements SmartConte
|
||||
*
|
||||
* @param configAttributes the context configuration attributes to process
|
||||
* @throws IllegalArgumentException if the supplied configuration attributes are
|
||||
* <code>null</code>, or if the supplied configuration attributes include both
|
||||
* {@code null}, or if the supplied configuration attributes include both
|
||||
* resource locations and annotated classes
|
||||
* @throws IllegalStateException if the XML-based loader detects default
|
||||
* configuration classes; if the annotation-based loader detects default
|
||||
@@ -232,7 +232,7 @@ public abstract class AbstractDelegatingSmartContextLoader implements SmartConte
|
||||
* </ul>
|
||||
*
|
||||
* @param mergedConfig the merged context configuration to use to load the application context
|
||||
* @throws IllegalArgumentException if the supplied merged configuration is <code>null</code>
|
||||
* @throws IllegalArgumentException if the supplied merged configuration is {@code null}
|
||||
* @throws IllegalStateException if neither candidate loader is capable of loading an
|
||||
* {@code ApplicationContext} from the supplied merged context configuration
|
||||
*/
|
||||
|
||||
@@ -39,7 +39,7 @@ import org.springframework.util.StringUtils;
|
||||
* {@link org.springframework.test.context.SmartContextLoader SmartContextLoader}
|
||||
* SPI, the context will be loaded from the {@link MergedContextConfiguration}
|
||||
* provided to {@link #loadContext(MergedContextConfiguration)}. In such cases, a
|
||||
* <code>SmartContextLoader</code> will decide whether to load the context from
|
||||
* {@code SmartContextLoader} will decide whether to load the context from
|
||||
* <em>locations</em> or <em>annotated classes</em>.</li>
|
||||
* </ul>
|
||||
*
|
||||
@@ -72,10 +72,10 @@ public abstract class AbstractGenericContextLoader extends AbstractContextLoader
|
||||
* <li>Calls {@link #prepareContext(ConfigurableApplicationContext, MergedContextConfiguration)}
|
||||
* to allow for customizing the context before bean definitions are loaded.</li>
|
||||
* <li>Calls {@link #customizeBeanFactory(DefaultListableBeanFactory)} to allow for customizing the
|
||||
* context's <code>DefaultListableBeanFactory</code>.</li>
|
||||
* context's {@code DefaultListableBeanFactory}.</li>
|
||||
* <li>Delegates to {@link #loadBeanDefinitions(GenericApplicationContext, MergedContextConfiguration)}
|
||||
* to populate the context from the locations or classes in the supplied
|
||||
* <code>MergedContextConfiguration</code>.</li>
|
||||
* {@code MergedContextConfiguration}.</li>
|
||||
* <li>Delegates to {@link AnnotationConfigUtils} for
|
||||
* {@link AnnotationConfigUtils#registerAnnotationConfigProcessors registering}
|
||||
* annotation configuration processors.</li>
|
||||
@@ -109,7 +109,7 @@ public abstract class AbstractGenericContextLoader extends AbstractContextLoader
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a Spring ApplicationContext from the supplied <code>locations</code>.
|
||||
* Load a Spring ApplicationContext from the supplied {@code locations}.
|
||||
*
|
||||
* <p>Implementation details:
|
||||
*
|
||||
@@ -118,7 +118,7 @@ public abstract class AbstractGenericContextLoader extends AbstractContextLoader
|
||||
* <li>Calls {@link #prepareContext(GenericApplicationContext)} to allow for customizing the context
|
||||
* before bean definitions are loaded.</li>
|
||||
* <li>Calls {@link #customizeBeanFactory(DefaultListableBeanFactory)} to allow for customizing the
|
||||
* context's <code>DefaultListableBeanFactory</code>.</li>
|
||||
* context's {@code DefaultListableBeanFactory}.</li>
|
||||
* <li>Delegates to {@link #createBeanDefinitionReader(GenericApplicationContext)} to create a
|
||||
* {@link BeanDefinitionReader} which is then used to populate the context
|
||||
* from the specified locations.</li>
|
||||
@@ -159,11 +159,11 @@ public abstract class AbstractGenericContextLoader extends AbstractContextLoader
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the {@link GenericApplicationContext} created by this <code>ContextLoader</code>.
|
||||
* Prepare the {@link GenericApplicationContext} created by this {@code ContextLoader}.
|
||||
* Called <i>before</i> bean definitions are read.
|
||||
*
|
||||
* <p>The default implementation is empty. Can be overridden in subclasses to
|
||||
* customize <code>GenericApplicationContext</code>'s standard settings.
|
||||
* customize {@code GenericApplicationContext}'s standard settings.
|
||||
*
|
||||
* @param context the context that should be prepared
|
||||
* @see #loadContext(MergedContextConfiguration)
|
||||
@@ -178,12 +178,12 @@ public abstract class AbstractGenericContextLoader extends AbstractContextLoader
|
||||
|
||||
/**
|
||||
* Customize the internal bean factory of the ApplicationContext created by
|
||||
* this <code>ContextLoader</code>.
|
||||
* this {@code ContextLoader}.
|
||||
*
|
||||
* <p>The default implementation is empty but can be overridden in subclasses
|
||||
* to customize <code>DefaultListableBeanFactory</code>'s standard settings.
|
||||
* to customize {@code DefaultListableBeanFactory}'s standard settings.
|
||||
*
|
||||
* @param beanFactory the bean factory created by this <code>ContextLoader</code>
|
||||
* @param beanFactory the bean factory created by this {@code ContextLoader}
|
||||
* @see #loadContext(MergedContextConfiguration)
|
||||
* @see #loadContext(String...)
|
||||
* @see DefaultListableBeanFactory#setAllowBeanDefinitionOverriding
|
||||
@@ -197,7 +197,7 @@ public abstract class AbstractGenericContextLoader extends AbstractContextLoader
|
||||
|
||||
/**
|
||||
* Load bean definitions into the supplied {@link GenericApplicationContext context}
|
||||
* from the locations or classes in the supplied <code>MergedContextConfiguration</code>.
|
||||
* from the locations or classes in the supplied {@code MergedContextConfiguration}.
|
||||
*
|
||||
* <p>The default implementation delegates to the {@link BeanDefinitionReader}
|
||||
* returned by {@link #createBeanDefinitionReader(GenericApplicationContext)} to
|
||||
@@ -223,9 +223,9 @@ public abstract class AbstractGenericContextLoader extends AbstractContextLoader
|
||||
* Factory method for creating a new {@link BeanDefinitionReader} for loading
|
||||
* bean definitions into the supplied {@link GenericApplicationContext context}.
|
||||
*
|
||||
* @param context the context for which the <code>BeanDefinitionReader</code>
|
||||
* @param context the context for which the {@code BeanDefinitionReader}
|
||||
* should be created
|
||||
* @return a <code>BeanDefinitionReader</code> for the supplied context
|
||||
* @return a {@code BeanDefinitionReader} for the supplied context
|
||||
* @see #loadContext(String...)
|
||||
* @see #loadBeanDefinitions
|
||||
* @see BeanDefinitionReader
|
||||
@@ -235,7 +235,7 @@ public abstract class AbstractGenericContextLoader extends AbstractContextLoader
|
||||
|
||||
/**
|
||||
* Customize the {@link GenericApplicationContext} created by this
|
||||
* <code>ContextLoader</code> <i>after</i> bean definitions have been
|
||||
* {@code ContextLoader} <i>after</i> bean definitions have been
|
||||
* loaded into the context but <i>before</i> the context is refreshed.
|
||||
*
|
||||
* <p>The default implementation is empty but can be overridden in subclasses
|
||||
|
||||
@@ -33,14 +33,14 @@ import org.springframework.util.ObjectUtils;
|
||||
* {@link org.springframework.test.context.ContextConfiguration @ContextConfiguration}
|
||||
* for a definition of <em>annotated class</em>.
|
||||
*
|
||||
* <p>Note: <code>AnnotationConfigContextLoader</code> supports <em>annotated classes</em>
|
||||
* <p>Note: {@code AnnotationConfigContextLoader} supports <em>annotated classes</em>
|
||||
* rather than the String-based resource locations defined by the legacy
|
||||
* {@link org.springframework.test.context.ContextLoader ContextLoader} API. Thus,
|
||||
* although <code>AnnotationConfigContextLoader</code> extends
|
||||
* <code>AbstractGenericContextLoader</code>, <code>AnnotationConfigContextLoader</code>
|
||||
* although {@code AnnotationConfigContextLoader} extends
|
||||
* {@code AbstractGenericContextLoader}, {@code AnnotationConfigContextLoader}
|
||||
* does <em>not</em> support any String-based methods defined by
|
||||
* <code>AbstractContextLoader</code> or <code>AbstractGenericContextLoader</code>.
|
||||
* Consequently, <code>AnnotationConfigContextLoader</code> should chiefly be
|
||||
* {@code AbstractContextLoader} or {@code AbstractGenericContextLoader}.
|
||||
* Consequently, {@code AnnotationConfigContextLoader} should chiefly be
|
||||
* considered a {@link org.springframework.test.context.SmartContextLoader SmartContextLoader}
|
||||
* rather than a {@link org.springframework.test.context.ContextLoader ContextLoader}.
|
||||
*
|
||||
@@ -60,9 +60,9 @@ public class AnnotationConfigContextLoader extends AbstractGenericContextLoader
|
||||
/**
|
||||
* Process <em>annotated classes</em> in the supplied {@link ContextConfigurationAttributes}.
|
||||
*
|
||||
* <p>If the <em>annotated classes</em> are <code>null</code> or empty and
|
||||
* {@link #isGenerateDefaultLocations()} returns <code>true</code>, this
|
||||
* <code>SmartContextLoader</code> will attempt to {@link
|
||||
* <p>If the <em>annotated classes</em> are {@code null} or empty and
|
||||
* {@link #isGenerateDefaultLocations()} returns {@code true}, this
|
||||
* {@code SmartContextLoader} will attempt to {@link
|
||||
* #detectDefaultConfigurationClasses detect default configuration classes}.
|
||||
* If defaults are detected they will be
|
||||
* {@link ContextConfigurationAttributes#setClasses(Class[]) set} in the
|
||||
@@ -91,7 +91,7 @@ public class AnnotationConfigContextLoader extends AbstractGenericContextLoader
|
||||
*
|
||||
* @param declaringClass the test class that declared {@code @ContextConfiguration}
|
||||
* @return an array of default configuration classes, potentially empty but
|
||||
* never <code>null</code>
|
||||
* never {@code null}
|
||||
* @see AnnotationConfigContextLoaderUtils
|
||||
*/
|
||||
protected Class<?>[] detectDefaultConfigurationClasses(Class<?> declaringClass) {
|
||||
@@ -101,7 +101,7 @@ public class AnnotationConfigContextLoader extends AbstractGenericContextLoader
|
||||
// --- AbstractContextLoader -----------------------------------------------
|
||||
|
||||
/**
|
||||
* <code>AnnotationConfigContextLoader</code> should be used as a
|
||||
* {@code AnnotationConfigContextLoader} should be used as a
|
||||
* {@link org.springframework.test.context.SmartContextLoader SmartContextLoader},
|
||||
* not as a legacy {@link org.springframework.test.context.ContextLoader ContextLoader}.
|
||||
* Consequently, this method is not supported.
|
||||
@@ -116,7 +116,7 @@ public class AnnotationConfigContextLoader extends AbstractGenericContextLoader
|
||||
}
|
||||
|
||||
/**
|
||||
* <code>AnnotationConfigContextLoader</code> should be used as a
|
||||
* {@code AnnotationConfigContextLoader} should be used as a
|
||||
* {@link org.springframework.test.context.SmartContextLoader SmartContextLoader},
|
||||
* not as a legacy {@link org.springframework.test.context.ContextLoader ContextLoader}.
|
||||
* Consequently, this method is not supported.
|
||||
@@ -131,7 +131,7 @@ public class AnnotationConfigContextLoader extends AbstractGenericContextLoader
|
||||
}
|
||||
|
||||
/**
|
||||
* <code>AnnotationConfigContextLoader</code> should be used as a
|
||||
* {@code AnnotationConfigContextLoader} should be used as a
|
||||
* {@link org.springframework.test.context.SmartContextLoader SmartContextLoader},
|
||||
* not as a legacy {@link org.springframework.test.context.ContextLoader ContextLoader}.
|
||||
* Consequently, this method is not supported.
|
||||
@@ -156,7 +156,7 @@ public class AnnotationConfigContextLoader extends AbstractGenericContextLoader
|
||||
* bean definitions.
|
||||
*
|
||||
* <p>Note that this method does not call {@link #createBeanDefinitionReader}
|
||||
* since <code>AnnotatedBeanDefinitionReader</code> is not an instance of
|
||||
* since {@code AnnotatedBeanDefinitionReader} is not an instance of
|
||||
* {@link BeanDefinitionReader}.
|
||||
*
|
||||
* @param context the context in which the annotated classes should be registered
|
||||
@@ -174,7 +174,7 @@ public class AnnotationConfigContextLoader extends AbstractGenericContextLoader
|
||||
}
|
||||
|
||||
/**
|
||||
* <code>AnnotationConfigContextLoader</code> should be used as a
|
||||
* {@code AnnotationConfigContextLoader} should be used as a
|
||||
* {@link org.springframework.test.context.SmartContextLoader SmartContextLoader},
|
||||
* not as a legacy {@link org.springframework.test.context.ContextLoader ContextLoader}.
|
||||
* Consequently, this method is not supported.
|
||||
|
||||
@@ -55,15 +55,15 @@ public abstract class AnnotationConfigContextLoaderUtils {
|
||||
* <p>Specifically, such candidates:
|
||||
*
|
||||
* <ul>
|
||||
* <li>must not be <code>null</code></li>
|
||||
* <li>must not be <code>private</code></li>
|
||||
* <li>must not be <code>final</code></li>
|
||||
* <li>must be <code>static</code></li>
|
||||
* <li>must not be {@code null}</li>
|
||||
* <li>must not be {@code private}</li>
|
||||
* <li>must not be {@code final}</li>
|
||||
* <li>must be {@code static}</li>
|
||||
* <li>must be annotated with {@code @Configuration}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param clazz the class to check
|
||||
* @return <code>true</code> if the supplied class meets the candidate criteria
|
||||
* @return {@code true} if the supplied class meets the candidate criteria
|
||||
*/
|
||||
private static boolean isDefaultConfigurationClassCandidate(Class<?> clazz) {
|
||||
return clazz != null && isStaticNonPrivateAndNonFinal(clazz) && clazz.isAnnotationPresent(Configuration.class);
|
||||
@@ -86,7 +86,7 @@ public abstract class AnnotationConfigContextLoaderUtils {
|
||||
* warning, and the potential candidate class will be ignored.
|
||||
* @param declaringClass the test class that declared {@code @ContextConfiguration}
|
||||
* @return an array of default configuration classes, potentially empty but
|
||||
* never <code>null</code>
|
||||
* never {@code null}
|
||||
*/
|
||||
public static Class<?>[] detectDefaultConfigurationClasses(Class<?> declaringClass) {
|
||||
Assert.notNull(declaringClass, "Declaring class must not be null");
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.core.Conventions;
|
||||
import org.springframework.test.context.TestContext;
|
||||
|
||||
/**
|
||||
* <code>TestExecutionListener</code> which provides support for dependency
|
||||
* {@code TestExecutionListener} which provides support for dependency
|
||||
* injection and initialization of test instances.
|
||||
*
|
||||
* @author Sam Brannen
|
||||
@@ -99,7 +99,7 @@ public class DependencyInjectionTestExecutionListener extends AbstractTestExecut
|
||||
* <p>The {@link #REINJECT_DEPENDENCIES_ATTRIBUTE} will be subsequently removed
|
||||
* from the test context, regardless of its value.
|
||||
* @param testContext the test context for which dependency injection should
|
||||
* be performed (never <code>null</code>)
|
||||
* be performed (never {@code null})
|
||||
* @throws Exception allows any exception to propagate
|
||||
* @see #prepareTestInstance(TestContext)
|
||||
* @see #beforeTestMethod(TestContext)
|
||||
|
||||
@@ -27,8 +27,8 @@ import org.springframework.test.context.TestContext;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* <code>TestExecutionListener</code> which provides support for marking the
|
||||
* <code>ApplicationContext</code> associated with a test as <em>dirty</em> for
|
||||
* {@code TestExecutionListener} which provides support for marking the
|
||||
* {@code ApplicationContext} associated with a test as <em>dirty</em> for
|
||||
* both test classes and test methods configured with the {@link DirtiesContext
|
||||
* @DirtiesContext} annotation.
|
||||
*
|
||||
@@ -47,7 +47,7 @@ public class DirtiesContextTestExecutionListener extends AbstractTestExecutionLi
|
||||
* {@link TestContext test context} as
|
||||
* {@link TestContext#markApplicationContextDirty() dirty}, and sets the
|
||||
* {@link DependencyInjectionTestExecutionListener#REINJECT_DEPENDENCIES_ATTRIBUTE
|
||||
* REINJECT_DEPENDENCIES_ATTRIBUTE} in the test context to <code>true</code>.
|
||||
* REINJECT_DEPENDENCIES_ATTRIBUTE} in the test context to {@code true}.
|
||||
*/
|
||||
protected void dirtyContext(TestContext testContext) {
|
||||
testContext.markApplicationContextDirty();
|
||||
@@ -65,7 +65,7 @@ public class DirtiesContextTestExecutionListener extends AbstractTestExecutionLi
|
||||
* {@link TestContext#markApplicationContextDirty() marked as dirty} and the
|
||||
* {@link DependencyInjectionTestExecutionListener#REINJECT_DEPENDENCIES_ATTRIBUTE
|
||||
* REINJECT_DEPENDENCIES_ATTRIBUTE} in the test context will be set to
|
||||
* <code>true</code>.
|
||||
* {@code true}.
|
||||
*/
|
||||
@Override
|
||||
public void afterTestMethod(TestContext testContext) throws Exception {
|
||||
@@ -100,7 +100,7 @@ public class DirtiesContextTestExecutionListener extends AbstractTestExecutionLi
|
||||
* and the
|
||||
* {@link DependencyInjectionTestExecutionListener#REINJECT_DEPENDENCIES_ATTRIBUTE
|
||||
* REINJECT_DEPENDENCIES_ATTRIBUTE} in the test context will be set to
|
||||
* <code>true</code>.
|
||||
* {@code true}.
|
||||
*/
|
||||
@Override
|
||||
public void afterTestClass(TestContext testContext) throws Exception {
|
||||
|
||||
@@ -42,7 +42,7 @@ public class GenericPropertiesContextLoader extends AbstractGenericContextLoader
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns "<code>-context.properties</code>".
|
||||
* Returns "{@code -context.properties}".
|
||||
*/
|
||||
@Override
|
||||
public String getResourceSuffix() {
|
||||
|
||||
@@ -40,7 +40,7 @@ public class GenericXmlContextLoader extends AbstractGenericContextLoader {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns "<code>-context.xml</code>".
|
||||
* Returns "{@code -context.xml}".
|
||||
*/
|
||||
@Override
|
||||
public String getResourceSuffix() {
|
||||
|
||||
@@ -145,7 +145,7 @@ public abstract class AbstractTestNGSpringContextTests implements IHookable, App
|
||||
|
||||
/**
|
||||
* Delegates to the {@link IHookCallBack#runTestMethod(ITestResult) test
|
||||
* method} in the supplied <code>callback</code> to execute the actual test
|
||||
* method} in the supplied {@code callback} to execute the actual test
|
||||
* and then tracks the exception thrown during test execution, if any.
|
||||
*
|
||||
* @see org.testng.IHookable#run(org.testng.IHookCallBack,
|
||||
|
||||
@@ -155,7 +155,7 @@ public abstract class AbstractTransactionalTestNGSpringContextTests extends Abst
|
||||
* @param continueOnError whether or not to continue without throwing an
|
||||
* exception in the event of an error
|
||||
* @throws DataAccessException if there is an error executing a statement
|
||||
* and continueOnError was <code>false</code>
|
||||
* and continueOnError was {@code false}
|
||||
*/
|
||||
protected void executeSqlScript(String sqlResourcePath, boolean continueOnError) throws DataAccessException {
|
||||
Resource resource = this.applicationContext.getResource(sqlResourcePath);
|
||||
|
||||
@@ -24,13 +24,13 @@ import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Test annotation to indicate that the annotated <code>public void</code>
|
||||
* Test annotation to indicate that the annotated {@code public void}
|
||||
* method should be executed <em>after</em> a transaction is ended for test
|
||||
* methods configured to run within a transaction via the
|
||||
* <code>@Transactional</code> annotation.
|
||||
* {@code @Transactional} annotation.
|
||||
* </p>
|
||||
* <p>
|
||||
* The <code>@AfterTransaction</code> methods of superclasses will be
|
||||
* The {@code @AfterTransaction} methods of superclasses will be
|
||||
* executed after those of the current class.
|
||||
* </p>
|
||||
*
|
||||
|
||||
@@ -24,13 +24,13 @@ import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Test annotation to indicate that the annotated <code>public void</code>
|
||||
* Test annotation to indicate that the annotated {@code public void}
|
||||
* method should be executed <em>before</em> a transaction is started for test
|
||||
* methods configured to run within a transaction via the
|
||||
* <code>@Transactional</code> annotation.
|
||||
* {@code @Transactional} annotation.
|
||||
* </p>
|
||||
* <p>
|
||||
* The <code>@BeforeTransaction</code> methods of superclasses will be
|
||||
* The {@code @BeforeTransaction} methods of superclasses will be
|
||||
* executed before those of the current class.
|
||||
* </p>
|
||||
*
|
||||
|
||||
@@ -305,12 +305,12 @@ public class TransactionalTestExecutionListener extends AbstractTestExecutionLis
|
||||
* Get the {@link PlatformTransactionManager transaction manager} to use
|
||||
* for the supplied {@link TestContext test context} and {@code qualifier}.
|
||||
* <p>Delegates to {@link #getTransactionManager(TestContext)} if the
|
||||
* supplied {@code qualifier} is <code>null</code> or empty.
|
||||
* supplied {@code qualifier} is {@code null} or empty.
|
||||
* @param testContext the test context for which the transaction manager
|
||||
* should be retrieved
|
||||
* @param qualifier the qualifier for selecting between multiple bean matches;
|
||||
* may be <code>null</code> or empty
|
||||
* @return the transaction manager to use, or <code>null</code> if not found
|
||||
* may be {@code null} or empty
|
||||
* @return the transaction manager to use, or {@code null} if not found
|
||||
* @throws BeansException if an error occurs while retrieving the transaction manager
|
||||
* @see #getTransactionManager(TestContext)
|
||||
*/
|
||||
@@ -342,7 +342,7 @@ public class TransactionalTestExecutionListener extends AbstractTestExecutionLis
|
||||
* for the supplied {@link TestContext test context}.
|
||||
* @param testContext the test context for which the transaction manager
|
||||
* should be retrieved
|
||||
* @return the transaction manager to use, or <code>null</code> if not found
|
||||
* @return the transaction manager to use, or {@code null} if not found
|
||||
* @throws BeansException if an error occurs while retrieving the transaction manager
|
||||
* @see #getTransactionManager(TestContext, String)
|
||||
*/
|
||||
@@ -453,7 +453,7 @@ public class TransactionalTestExecutionListener extends AbstractTestExecutionLis
|
||||
|
||||
/**
|
||||
* Gets all methods in the supplied {@link Class class} and its superclasses
|
||||
* which are annotated with the supplied <code>annotationType</code> but
|
||||
* which are annotated with the supplied {@code annotationType} but
|
||||
* which are not <em>shadowed</em> by methods overridden in subclasses.
|
||||
* <p>Note: This code has been borrowed from
|
||||
* {@link org.junit.internal.runners.TestClass#getAnnotatedMethods(Class)}
|
||||
@@ -480,11 +480,11 @@ public class TransactionalTestExecutionListener extends AbstractTestExecutionLis
|
||||
* Determines if the supplied {@link Method method} is <em>shadowed</em>
|
||||
* by a method in supplied {@link List list} of previous methods.
|
||||
* <p>Note: This code has been borrowed from
|
||||
* {@link org.junit.internal.runners.TestClass#isShadowed(Method,List)}.
|
||||
* {@link org.junit.internal.runners.TestClass#isShadowed(Method, List)}.
|
||||
* @param method the method to check for shadowing
|
||||
* @param previousMethods the list of methods which have previously been processed
|
||||
* @return <code>true</code> if the supplied method is shadowed by a
|
||||
* method in the <code>previousMethods</code> list
|
||||
* @return {@code true} if the supplied method is shadowed by a
|
||||
* method in the {@code previousMethods} list
|
||||
*/
|
||||
private boolean isShadowed(Method method, List<Method> previousMethods) {
|
||||
for (Method each : previousMethods) {
|
||||
@@ -499,10 +499,10 @@ public class TransactionalTestExecutionListener extends AbstractTestExecutionLis
|
||||
* Determines if the supplied {@link Method current method} is
|
||||
* <em>shadowed</em> by a {@link Method previous method}.
|
||||
* <p>Note: This code has been borrowed from
|
||||
* {@link org.junit.internal.runners.TestClass#isShadowed(Method,Method)}.
|
||||
* {@link org.junit.internal.runners.TestClass#isShadowed(Method, Method)}.
|
||||
* @param current the current method
|
||||
* @param previous the previous method
|
||||
* @return <code>true</code> if the previous method shadows the current one
|
||||
* @return {@code true} if the previous method shadows the current one
|
||||
*/
|
||||
private boolean isShadowed(Method current, Method previous) {
|
||||
if (!previous.getName().equals(current.getName())) {
|
||||
|
||||
@@ -160,7 +160,7 @@ public abstract class AbstractGenericWebContextLoader extends AbstractContextLoa
|
||||
* created by this context loader.
|
||||
*
|
||||
* <p>The default implementation is empty but can be overridden in subclasses
|
||||
* to customize <code>DefaultListableBeanFactory</code>'s standard settings.
|
||||
* to customize {@code DefaultListableBeanFactory}'s standard settings.
|
||||
*
|
||||
* @param beanFactory the bean factory created by this context loader
|
||||
* @param webMergedConfig the merged context configuration to use to load the
|
||||
@@ -177,7 +177,7 @@ public abstract class AbstractGenericWebContextLoader extends AbstractContextLoa
|
||||
|
||||
/**
|
||||
* Load bean definitions into the supplied {@link GenericWebApplicationContext context}
|
||||
* from the locations or classes in the supplied <code>WebMergedContextConfiguration</code>.
|
||||
* from the locations or classes in the supplied {@code WebMergedContextConfiguration}.
|
||||
*
|
||||
* <p>Concrete subclasses must provide an appropriate implementation.
|
||||
*
|
||||
|
||||
@@ -33,15 +33,15 @@ import org.springframework.web.context.support.GenericWebApplicationContext;
|
||||
* {@link org.springframework.test.context.ContextConfiguration @ContextConfiguration}
|
||||
* for a definition of <em>annotated class</em>.
|
||||
*
|
||||
* <p>Note: <code>AnnotationConfigWebContextLoader</code> supports <em>annotated classes</em>
|
||||
* <p>Note: {@code AnnotationConfigWebContextLoader} supports <em>annotated classes</em>
|
||||
* rather than the String-based resource locations defined by the legacy
|
||||
* {@link org.springframework.test.context.ContextLoader ContextLoader} API. Thus,
|
||||
* although <code>AnnotationConfigWebContextLoader</code> extends
|
||||
* <code>AbstractGenericWebContextLoader</code>, <code>AnnotationConfigWebContextLoader</code>
|
||||
* although {@code AnnotationConfigWebContextLoader} extends
|
||||
* {@code AbstractGenericWebContextLoader}, {@code AnnotationConfigWebContextLoader}
|
||||
* does <em>not</em> support any String-based methods defined by
|
||||
* {@link org.springframework.test.context.support.AbstractContextLoader
|
||||
* AbstractContextLoader} or <code>AbstractGenericWebContextLoader</code>.
|
||||
* Consequently, <code>AnnotationConfigWebContextLoader</code> should chiefly be
|
||||
* AbstractContextLoader} or {@code AbstractGenericWebContextLoader}.
|
||||
* Consequently, {@code AnnotationConfigWebContextLoader} should chiefly be
|
||||
* considered a {@link org.springframework.test.context.SmartContextLoader SmartContextLoader}
|
||||
* rather than a {@link org.springframework.test.context.ContextLoader ContextLoader}.
|
||||
*
|
||||
@@ -61,9 +61,9 @@ public class AnnotationConfigWebContextLoader extends AbstractGenericWebContextL
|
||||
/**
|
||||
* Process <em>annotated classes</em> in the supplied {@link ContextConfigurationAttributes}.
|
||||
*
|
||||
* <p>If the <em>annotated classes</em> are <code>null</code> or empty and
|
||||
* {@link #isGenerateDefaultLocations()} returns <code>true</code>, this
|
||||
* <code>SmartContextLoader</code> will attempt to {@linkplain
|
||||
* <p>If the <em>annotated classes</em> are {@code null} or empty and
|
||||
* {@link #isGenerateDefaultLocations()} returns {@code true}, this
|
||||
* {@code SmartContextLoader} will attempt to {@linkplain
|
||||
* #detectDefaultConfigurationClasses detect default configuration classes}.
|
||||
* If defaults are detected they will be
|
||||
* {@linkplain ContextConfigurationAttributes#setClasses(Class[]) set} in the
|
||||
@@ -90,7 +90,7 @@ public class AnnotationConfigWebContextLoader extends AbstractGenericWebContextL
|
||||
*
|
||||
* @param declaringClass the test class that declared {@code @ContextConfiguration}
|
||||
* @return an array of default configuration classes, potentially empty but
|
||||
* never <code>null</code>
|
||||
* never {@code null}
|
||||
* @see AnnotationConfigContextLoaderUtils
|
||||
*/
|
||||
protected Class<?>[] detectDefaultConfigurationClasses(Class<?> declaringClass) {
|
||||
|
||||
@@ -39,7 +39,7 @@ public class GenericXmlWebContextLoader extends AbstractGenericWebContextLoader
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns "<code>-context.xml</code>".
|
||||
* Returns "{@code -context.xml}".
|
||||
*/
|
||||
protected String getResourceSuffix() {
|
||||
return "-context.xml";
|
||||
|
||||
@@ -62,11 +62,11 @@ public class WebMergedContextConfiguration extends MergedContextConfiguration {
|
||||
* supplied test class, resource locations, annotated classes, context
|
||||
* initializers, active profiles, resource base path, and {@code ContextLoader}.
|
||||
*
|
||||
* <p>If a <code>null</code> value is supplied for <code>locations</code>,
|
||||
* <code>classes</code>, or <code>activeProfiles</code> an empty array will
|
||||
* be stored instead. If a <code>null</code> value is supplied for the
|
||||
* <code>contextInitializerClasses</code> an empty set will be stored instead.
|
||||
* If an <em>empty</em> value is supplied for the <code>resourceBasePath</code>
|
||||
* <p>If a {@code null} value is supplied for {@code locations},
|
||||
* {@code classes}, or {@code activeProfiles} an empty array will
|
||||
* be stored instead. If a {@code null} value is supplied for the
|
||||
* {@code contextInitializerClasses} an empty set will be stored instead.
|
||||
* If an <em>empty</em> value is supplied for the {@code resourceBasePath}
|
||||
* an empty string will be used. Furthermore, active profiles will be sorted,
|
||||
* and duplicate profiles will be removed.
|
||||
*
|
||||
@@ -76,7 +76,7 @@ public class WebMergedContextConfiguration extends MergedContextConfiguration {
|
||||
* @param contextInitializerClasses the merged context initializer classes
|
||||
* @param activeProfiles the merged active bean definition profiles
|
||||
* @param resourceBasePath the resource path to the root directory of the web application
|
||||
* @param contextLoader the resolved <code>ContextLoader</code>
|
||||
* @param contextLoader the resolved {@code ContextLoader}
|
||||
*/
|
||||
public WebMergedContextConfiguration(
|
||||
Class<?> testClass,
|
||||
|
||||
@@ -295,7 +295,7 @@ public class JdbcTestUtils {
|
||||
/**
|
||||
* Split an SQL script into separate statements delimited by the provided
|
||||
* delimiter character. Each individual statement will be added to the
|
||||
* provided <code>List</code>.
|
||||
* provided {@code List}.
|
||||
* <p>Within a statement, "{@code --}" will be used as the comment prefix;
|
||||
* any text beginning with the comment prefix and extending to the end of
|
||||
* the line will be omitted from the statement. In addition, multiple adjacent
|
||||
|
||||
@@ -86,7 +86,7 @@ public abstract class SimpleJdbcTestUtils {
|
||||
* @param continueOnError whether or not to continue without throwing an
|
||||
* exception in the event of an error
|
||||
* @throws DataAccessException if there is an error executing a statement
|
||||
* and continueOnError was <code>false</code>
|
||||
* and continueOnError was {@code false}
|
||||
*/
|
||||
public static void executeSqlScript(SimpleJdbcTemplate simpleJdbcTemplate, ResourceLoader resourceLoader,
|
||||
String sqlResourcePath, boolean continueOnError) throws DataAccessException {
|
||||
@@ -106,7 +106,7 @@ public abstract class SimpleJdbcTestUtils {
|
||||
* @param continueOnError whether or not to continue without throwing an
|
||||
* exception in the event of an error.
|
||||
* @throws DataAccessException if there is an error executing a statement
|
||||
* and continueOnError was <code>false</code>
|
||||
* and continueOnError was {@code false}
|
||||
*/
|
||||
public static void executeSqlScript(SimpleJdbcTemplate simpleJdbcTemplate, Resource resource,
|
||||
boolean continueOnError) throws DataAccessException {
|
||||
@@ -125,7 +125,7 @@ public abstract class SimpleJdbcTestUtils {
|
||||
* @param continueOnError whether or not to continue without throwing an
|
||||
* exception in the event of an error.
|
||||
* @throws DataAccessException if there is an error executing a statement
|
||||
* and continueOnError was <code>false</code>
|
||||
* and continueOnError was {@code false}
|
||||
*/
|
||||
public static void executeSqlScript(SimpleJdbcTemplate simpleJdbcTemplate, EncodedResource resource,
|
||||
boolean continueOnError) throws DataAccessException {
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.springframework.instrument.classloading.ResourceOverridingShadowingCl
|
||||
|
||||
/**
|
||||
* Subclass of {@link AbstractJpaTests} that activates AspectJ load-time weaving and
|
||||
* allows for specifying a custom location for AspectJ's <code>aop.xml</code> file.
|
||||
* allows for specifying a custom location for AspectJ's {@code aop.xml} file.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
@@ -34,7 +34,7 @@ import org.springframework.instrument.classloading.ResourceOverridingShadowingCl
|
||||
public abstract class AbstractAspectjJpaTests extends AbstractJpaTests {
|
||||
|
||||
/**
|
||||
* Default location of the <code>aop.xml</code> file in the class path:
|
||||
* Default location of the {@code aop.xml} file in the class path:
|
||||
* "META-INF/aop.xml"
|
||||
*/
|
||||
public static final String DEFAULT_AOP_XML_LOCATION = "META-INF/aop.xml";
|
||||
@@ -48,9 +48,9 @@ public abstract class AbstractAspectjJpaTests extends AbstractJpaTests {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the actual location of the <code>aop.xml</code> file
|
||||
* Return the actual location of the {@code aop.xml} file
|
||||
* in the class path. The default is "META-INF/aop.xml".
|
||||
* <p>Override this method to point to a specific <code>aop.xml</code>
|
||||
* <p>Override this method to point to a specific {@code aop.xml}
|
||||
* file within your test suite, allowing for different config files
|
||||
* to co-exist within the same class path.
|
||||
*/
|
||||
|
||||
@@ -122,8 +122,8 @@ public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactio
|
||||
/**
|
||||
* Create an EntityManager that will always automatically enlist itself in current
|
||||
* transactions, in contrast to an EntityManager returned by
|
||||
* <code>EntityManagerFactory.createEntityManager()</code>
|
||||
* (which requires an explicit <code>joinTransaction()</code> call).
|
||||
* {@code EntityManagerFactory.createEntityManager()}
|
||||
* (which requires an explicit {@code joinTransaction()} call).
|
||||
*/
|
||||
protected EntityManager createContainerManagedEntityManager() {
|
||||
return ExtendedEntityManagerCreator.createContainerManagedEntityManager(this.entityManagerFactory);
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.springframework.instrument.classloading.ResourceOverridingShadowingCl
|
||||
|
||||
/**
|
||||
* Subclass of ShadowingClassLoader that overrides attempts to
|
||||
* locate <code>orm.xml</code>.
|
||||
* locate {@code orm.xml}.
|
||||
*
|
||||
* <p>This class must <b>not</b> be an inner class of AbstractJpaTests
|
||||
* to avoid it being loaded until first used.
|
||||
@@ -33,7 +33,7 @@ import org.springframework.instrument.classloading.ResourceOverridingShadowingCl
|
||||
class OrmXmlOverridingShadowingClassLoader extends ResourceOverridingShadowingClassLoader {
|
||||
|
||||
/**
|
||||
* Default location of the <code>orm.xml</code> file in the class path:
|
||||
* Default location of the {@code orm.xml} file in the class path:
|
||||
* "META-INF/orm.xml"
|
||||
*/
|
||||
public static final String DEFAULT_ORM_XML_LOCATION = "META-INF/orm.xml";
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
* Convenient JUnit 3.8 base class for tests dealing with Spring Web MVC
|
||||
* {@link org.springframework.web.servlet.ModelAndView ModelAndView} objects.
|
||||
*
|
||||
* <p>All <code>assert*()</code> methods throw {@link AssertionFailedError}s.
|
||||
* <p>All {@code assert*()} methods throw {@link AssertionFailedError}s.
|
||||
*
|
||||
* <p>Consider the use of {@link ModelAndViewAssert} with JUnit 4 and TestNG.
|
||||
*
|
||||
@@ -47,12 +47,12 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
public abstract class AbstractModelAndViewTests extends TestCase {
|
||||
|
||||
/**
|
||||
* Checks whether the model value under the given <code>modelName</code>
|
||||
* exists and checks it type, based on the <code>expectedType</code>. If
|
||||
* Checks whether the model value under the given {@code modelName}
|
||||
* exists and checks it type, based on the {@code expectedType}. If
|
||||
* the model entry exists and the type matches, the model value is returned.
|
||||
* @param mav ModelAndView to test against (never <code>null</code>)
|
||||
* @param mav ModelAndView to test against (never {@code null})
|
||||
* @param modelName name of the object to add to the model (never
|
||||
* <code>null</code>)
|
||||
* {@code null})
|
||||
* @param expectedType expected type of the model value
|
||||
* @return the model value
|
||||
*/
|
||||
@@ -67,9 +67,9 @@ public abstract class AbstractModelAndViewTests extends TestCase {
|
||||
|
||||
/**
|
||||
* Compare each individual entry in a list, without first sorting the lists.
|
||||
* @param mav ModelAndView to test against (never <code>null</code>)
|
||||
* @param mav ModelAndView to test against (never {@code null})
|
||||
* @param modelName name of the object to add to the model (never
|
||||
* <code>null</code>)
|
||||
* {@code null})
|
||||
* @param expectedList the expected list
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
@@ -84,9 +84,9 @@ public abstract class AbstractModelAndViewTests extends TestCase {
|
||||
|
||||
/**
|
||||
* Assert whether or not a model attribute is available.
|
||||
* @param mav ModelAndView to test against (never <code>null</code>)
|
||||
* @param mav ModelAndView to test against (never {@code null})
|
||||
* @param modelName name of the object to add to the model (never
|
||||
* <code>null</code>)
|
||||
* {@code null})
|
||||
*/
|
||||
protected void assertModelAttributeAvailable(ModelAndView mav, String modelName) {
|
||||
try {
|
||||
@@ -98,11 +98,11 @@ public abstract class AbstractModelAndViewTests extends TestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare a given <code>expectedValue</code> to the value from the model
|
||||
* bound under the given <code>modelName</code>.
|
||||
* @param mav ModelAndView to test against (never <code>null</code>)
|
||||
* Compare a given {@code expectedValue} to the value from the model
|
||||
* bound under the given {@code modelName}.
|
||||
* @param mav ModelAndView to test against (never {@code null})
|
||||
* @param modelName name of the object to add to the model (never
|
||||
* <code>null</code>)
|
||||
* {@code null})
|
||||
* @param expectedValue the model value
|
||||
*/
|
||||
protected void assertModelAttributeValue(ModelAndView mav, String modelName, Object expectedValue) {
|
||||
@@ -115,9 +115,9 @@ public abstract class AbstractModelAndViewTests extends TestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Inspect the <code>expectedModel</code> to see if all elements in the
|
||||
* Inspect the {@code expectedModel} to see if all elements in the
|
||||
* model appear and are equal.
|
||||
* @param mav ModelAndView to test against (never <code>null</code>)
|
||||
* @param mav ModelAndView to test against (never {@code null})
|
||||
* @param expectedModel the expected model
|
||||
*/
|
||||
protected void assertModelAttributeValues(ModelAndView mav, Map<String, Object> expectedModel) {
|
||||
@@ -132,11 +132,11 @@ public abstract class AbstractModelAndViewTests extends TestCase {
|
||||
/**
|
||||
* Compare each individual entry in a list after having sorted both lists
|
||||
* (optionally using a comparator).
|
||||
* @param mav ModelAndView to test against (never <code>null</code>)
|
||||
* @param mav ModelAndView to test against (never {@code null})
|
||||
* @param modelName name of the object to add to the model (never
|
||||
* <code>null</code>)
|
||||
* {@code null})
|
||||
* @param expectedList the expected list
|
||||
* @param comparator the comparator to use (may be <code>null</code>). If
|
||||
* @param comparator the comparator to use (may be {@code null}). If
|
||||
* not specifying the comparator, both lists will be sorted not using
|
||||
* any comparator.
|
||||
*/
|
||||
@@ -153,8 +153,8 @@ public abstract class AbstractModelAndViewTests extends TestCase {
|
||||
|
||||
/**
|
||||
* Check to see if the view name in the ModelAndView matches the given
|
||||
* <code>expectedName</code>.
|
||||
* @param mav ModelAndView to test against (never <code>null</code>)
|
||||
* {@code expectedName}.
|
||||
* @param mav ModelAndView to test against (never {@code null})
|
||||
* @param expectedName the name of the model value
|
||||
*/
|
||||
protected void assertViewName(ModelAndView mav, String expectedName) {
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
* with Spring Web MVC {@link org.springframework.web.servlet.ModelAndView
|
||||
* ModelAndView} objects.
|
||||
* <p>
|
||||
* Intended for use with JUnit 4 and TestNG. All <code>assert*()</code> methods
|
||||
* Intended for use with JUnit 4 and TestNG. All {@code assert*()} methods
|
||||
* throw {@link AssertionError}s.
|
||||
*
|
||||
* @author Sam Brannen
|
||||
@@ -45,13 +45,13 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
public abstract class ModelAndViewAssert {
|
||||
|
||||
/**
|
||||
* Checks whether the model value under the given <code>modelName</code>
|
||||
* exists and checks it type, based on the <code>expectedType</code>. If the
|
||||
* Checks whether the model value under the given {@code modelName}
|
||||
* exists and checks it type, based on the {@code expectedType}. If the
|
||||
* model entry exists and the type matches, the model value is returned.
|
||||
*
|
||||
* @param mav ModelAndView to test against (never <code>null</code>)
|
||||
* @param mav ModelAndView to test against (never {@code null})
|
||||
* @param modelName name of the object to add to the model (never
|
||||
* <code>null</code>)
|
||||
* {@code null})
|
||||
* @param expectedType expected type of the model value
|
||||
* @return the model value
|
||||
*/
|
||||
@@ -69,9 +69,9 @@ public abstract class ModelAndViewAssert {
|
||||
/**
|
||||
* Compare each individual entry in a list, without first sorting the lists.
|
||||
*
|
||||
* @param mav ModelAndView to test against (never <code>null</code>)
|
||||
* @param mav ModelAndView to test against (never {@code null})
|
||||
* @param modelName name of the object to add to the model (never
|
||||
* <code>null</code>)
|
||||
* {@code null})
|
||||
* @param expectedList the expected list
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
@@ -88,9 +88,9 @@ public abstract class ModelAndViewAssert {
|
||||
/**
|
||||
* Assert whether or not a model attribute is available.
|
||||
*
|
||||
* @param mav ModelAndView to test against (never <code>null</code>)
|
||||
* @param mav ModelAndView to test against (never {@code null})
|
||||
* @param modelName name of the object to add to the model (never
|
||||
* <code>null</code>)
|
||||
* {@code null})
|
||||
*/
|
||||
public static void assertModelAttributeAvailable(ModelAndView mav, String modelName) {
|
||||
assertTrue("ModelAndView is null", mav != null);
|
||||
@@ -100,12 +100,12 @@ public abstract class ModelAndViewAssert {
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare a given <code>expectedValue</code> to the value from the model
|
||||
* bound under the given <code>modelName</code>.
|
||||
* Compare a given {@code expectedValue} to the value from the model
|
||||
* bound under the given {@code modelName}.
|
||||
*
|
||||
* @param mav ModelAndView to test against (never <code>null</code>)
|
||||
* @param mav ModelAndView to test against (never {@code null})
|
||||
* @param modelName name of the object to add to the model (never
|
||||
* <code>null</code>)
|
||||
* {@code null})
|
||||
* @param expectedValue the model value
|
||||
*/
|
||||
public static void assertModelAttributeValue(ModelAndView mav, String modelName, Object expectedValue) {
|
||||
@@ -116,10 +116,10 @@ public abstract class ModelAndViewAssert {
|
||||
}
|
||||
|
||||
/**
|
||||
* Inspect the <code>expectedModel</code> to see if all elements in the
|
||||
* Inspect the {@code expectedModel} to see if all elements in the
|
||||
* model appear and are equal.
|
||||
*
|
||||
* @param mav ModelAndView to test against (never <code>null</code>)
|
||||
* @param mav ModelAndView to test against (never {@code null})
|
||||
* @param expectedModel the expected model
|
||||
*/
|
||||
public static void assertModelAttributeValues(ModelAndView mav, Map<String, Object> expectedModel) {
|
||||
@@ -152,11 +152,11 @@ public abstract class ModelAndViewAssert {
|
||||
* Compare each individual entry in a list after having sorted both lists
|
||||
* (optionally using a comparator).
|
||||
*
|
||||
* @param mav ModelAndView to test against (never <code>null</code>)
|
||||
* @param mav ModelAndView to test against (never {@code null})
|
||||
* @param modelName name of the object to add to the model (never
|
||||
* <code>null</code>)
|
||||
* {@code null})
|
||||
* @param expectedList the expected list
|
||||
* @param comparator the comparator to use (may be <code>null</code>). If
|
||||
* @param comparator the comparator to use (may be {@code null}). If
|
||||
* not specifying the comparator, both lists will be sorted not using any
|
||||
* comparator.
|
||||
*/
|
||||
@@ -186,9 +186,9 @@ public abstract class ModelAndViewAssert {
|
||||
|
||||
/**
|
||||
* Check to see if the view name in the ModelAndView matches the given
|
||||
* <code>expectedName</code>.
|
||||
* {@code expectedName}.
|
||||
*
|
||||
* @param mav ModelAndView to test against (never <code>null</code>)
|
||||
* @param mav ModelAndView to test against (never {@code null})
|
||||
* @param expectedName the name of the model value
|
||||
*/
|
||||
public static void assertViewName(ModelAndView mav, String expectedName) {
|
||||
|
||||
Reference in New Issue
Block a user