Replace 'e.g.' with 'for example' in documentation and comments

Closes gh-33515
This commit is contained in:
Yanming Zhou
2024-09-26 14:03:46 +02:00
committed by Sam Brannen
parent e55fe9077f
commit 8941e2876e
722 changed files with 1290 additions and 1290 deletions

View File

@@ -77,7 +77,7 @@ public class MockClientHttpRequest extends AbstractClientHttpRequest {
* Configure a custom handler for writing the request body.
*
* <p>The default write handler consumes and caches the request body so it
* may be accessed subsequently, e.g. in test assertions. Use this property
* may be accessed subsequently, for example, in test assertions. Use this property
* when the request body is an infinite stream.
* @param writeHandler the write handler to use returning {@code Mono<Void>}
* when the body has been "written" (i.e. consumed).

View File

@@ -1460,7 +1460,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
}
/**
* Best effort to detect a Servlet path mapping, e.g. {@code "/foo/*"}, by
* Best effort to detect a Servlet path mapping, for example, {@code "/foo/*"}, by
* checking whether the length of requestURI > contextPath + servletPath.
* This helps {@link org.springframework.web.util.ServletRequestPathUtils}
* to take into account the Servlet path when parsing the requestURI.

View File

@@ -77,7 +77,7 @@ public interface ContextLoader {
* <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 freeing external resources held by
* beans within the context, e.g. temporary files.
* beans within the context, for example, temporary files.
* @param locations the resource locations to use to load the application context
* @return a new application context
* @throws Exception if context loading failed

View File

@@ -176,7 +176,7 @@ public class TestContextManager {
/**
* Get the current {@link TestExecutionListener TestExecutionListeners}
* registered for this {@code TestContextManager}.
* <p>Allows for modifications, e.g. adding a listener to the beginning of the list.
* <p>Allows for modifications, for example, adding a listener to the beginning of the list.
* However, make sure to keep the list stable while actually executing tests.
*/
public final List<TestExecutionListener> getTestExecutionListeners() {

View File

@@ -40,7 +40,7 @@ import org.springframework.core.io.support.PropertySourceFactory;
* operating system's environment or Java system properties as well as property
* sources added by the application declaratively via
* {@link org.springframework.context.annotation.PropertySource @PropertySource}
* or programmatically (e.g., via an
* or programmatically (for example, via an
* {@link org.springframework.context.ApplicationContextInitializer ApplicationContextInitializer}
* or some other means). Thus, test property sources can be used to selectively
* override properties defined in system and application property sources.
@@ -128,7 +128,7 @@ public @interface TestPropertySource {
* test class is defined. A path starting with a slash will be treated as an
* <em>absolute</em> classpath resource, for example:
* {@code "/org/example/test.xml"}. A path which references a
* URL (e.g., a path prefixed with
* URL (for example, a path prefixed with
* {@link org.springframework.util.ResourceUtils#CLASSPATH_URL_PREFIX classpath:},
* {@link org.springframework.util.ResourceUtils#FILE_URL_PREFIX file:},
* {@code http:}, etc.) will be loaded using the specified resource protocol.

View File

@@ -111,7 +111,7 @@ public interface ContextCache {
* {@linkplain org.springframework.context.ConfigurableApplicationContext#close() close}
* it if it is an instance of {@code ConfigurableApplicationContext}.
* <p>Generally speaking, this method should be called to properly evict
* a context from the cache (e.g., due to a custom eviction policy) or if
* a context from the cache (for example, due to a custom eviction policy) or if
* the state of a singleton bean has been modified, potentially affecting
* future interaction with the context.
* <p>In addition, the semantics of the supplied {@code HierarchyMode} must

View File

@@ -111,7 +111,7 @@ public @interface Sql {
* test class is defined. A path starting with a slash will be treated as an
* <em>absolute</em> classpath resource, for example:
* {@code "/org/example/schema.sql"}. A path which references a
* URL (e.g., a path prefixed with
* URL (for example, a path prefixed with
* {@link org.springframework.util.ResourceUtils#CLASSPATH_URL_PREFIX classpath:},
* {@link org.springframework.util.ResourceUtils#FILE_URL_PREFIX file:},
* {@code http:}, etc.) will be loaded using the specified resource protocol.

View File

@@ -49,7 +49,7 @@ import org.springframework.util.Assert;
* supports both XML configuration files and Groovy scripts simultaneously.
*
* <p>Placing an empty {@code @ContextConfiguration} annotation on a test class signals
* that default resource locations (e.g., XML configuration files or Groovy scripts)
* that default resource locations (for example, XML configuration files or Groovy scripts)
* or default
* {@linkplain org.springframework.context.annotation.Configuration configuration classes}
* should be detected. Furthermore, if a specific {@link ContextLoader} or
@@ -57,7 +57,7 @@ import org.springframework.util.Assert;
* {@code @ContextConfiguration}, a concrete subclass of
* {@code AbstractDelegatingSmartContextLoader} will be used as the default loader,
* thus providing automatic support for either path-based resource locations
* (e.g., XML configuration files and Groovy scripts) or annotated classes,
* (for example, XML configuration files and Groovy scripts) or annotated classes,
* but not both simultaneously.
*
* <p>A test class may optionally declare neither path-based resource locations

View File

@@ -32,7 +32,7 @@ import org.springframework.util.ClassUtils;
/**
* Utility methods for {@link SmartContextLoader SmartContextLoaders} that deal
* with component classes (e.g., {@link Configuration @Configuration} classes).
* with component classes (for example, {@link Configuration @Configuration} classes).
*
* @author Sam Brannen
* @since 3.2

View File

@@ -47,7 +47,7 @@ public class DependencyInjectionTestExecutionListener extends AbstractTestExecut
* dependencies will be injected in
* {@link #prepareTestInstance(TestContext) prepareTestInstance()} in any
* case.
* <p>Clients of a {@link TestContext} (e.g., other
* <p>Clients of a {@link TestContext} (for example, other
* {@link org.springframework.test.context.TestExecutionListener TestExecutionListeners})
* may therefore choose to set this attribute to signal that dependencies
* should be reinjected <em>between</em> execution of individual test

View File

@@ -90,7 +90,7 @@ public abstract class TestPropertySourceUtils {
TestPropertySourceAttributes previousAttributes = null;
// Iterate over all aggregate levels, where each level is represented by
// a list of merged annotations found at that level (e.g., on a test
// a list of merged annotations found at that level (for example, on a test
// class in the class hierarchy).
for (List<MergedAnnotation<TestPropertySource>> aggregatedAnnotations :
findRepeatableAnnotations(testClass, TestPropertySource.class)) {

View File

@@ -110,7 +110,7 @@ import org.springframework.util.StringUtils;
* {@code ApplicationContext} for the test. In case there are multiple
* instances of {@code PlatformTransactionManager} within the test's
* {@code ApplicationContext}, a <em>qualifier</em> may be declared via
* {@link Transactional @Transactional} (e.g., {@code @Transactional("myTxMgr")}
* {@link Transactional @Transactional} (for example, {@code @Transactional("myTxMgr")}
* or {@code @Transactional(transactionManager = "myTxMgr")}, or
* {@link org.springframework.transaction.annotation.TransactionManagementConfigurer
* TransactionManagementConfigurer} can be implemented by an

View File

@@ -77,7 +77,7 @@ public abstract class TestContextResourceUtils {
* <li>A path starting with a slash will be treated as an absolute path
* within the classpath, for example: {@code "/org/example/schema.sql"}.
* Such a path will be prepended with the {@code classpath:} prefix.
* <li>A path which is already prefixed with a URL protocol (e.g.,
* <li>A path which is already prefixed with a URL protocol (for example,
* {@code classpath:}, {@code file:}, {@code http:}, etc.) will not have its
* protocol modified.
* </ul>

View File

@@ -60,7 +60,7 @@ public @interface WebAppConfiguration {
/**
* The resource path to the root directory of the web application.
* <p>A path that does not include a Spring resource prefix (e.g., {@code classpath:},
* <p>A path that does not include a Spring resource prefix (for example, {@code classpath:},
* {@code file:}, etc.) will be interpreted as a file system resource, and a
* path should not end with a slash.
* <p>Defaults to {@code "src/main/webapp"} as a file system resource. Note

View File

@@ -223,7 +223,7 @@ public class XpathExpectationsHelper {
/**
* Parse the given XML content to a {@link Document}.
* @param xml the content to parse
* @param encoding optional content encoding, if provided as metadata (e.g. in HTTP headers)
* @param encoding optional content encoding, if provided as metadata (for example, in HTTP headers)
* @return the parsed document
*/
protected Document parseXmlByteArray(byte[] xml, @Nullable String encoding) throws Exception {

View File

@@ -80,7 +80,7 @@ public class ExchangeResult {
@Nullable
private final Object mockServerResult;
/** Ensure single logging, e.g. for expectAll. */
/** Ensure single logging, for example, for expectAll. */
private boolean diagnosticsLogged;

View File

@@ -25,7 +25,7 @@ import org.springframework.web.server.adapter.WebHttpHandlerBuilder;
*
* <p>An implementation of this interface can be plugged in via
* {@link WebTestClient.MockServerSpec#apply} where instances are likely obtained
* via static methods, e.g.:
* via static methods, for example:
*
* <pre class="code">
* import static org.example.ExampleSetup.securitySetup;

View File

@@ -94,7 +94,7 @@ public interface WebTestClient {
/**
* The name of a request header used to assign a unique id to every request
* performed through the {@code WebTestClient}. This can be useful for
* storing contextual information at all phases of request processing (e.g.
* storing contextual information at all phases of request processing (for example,
* from a server-side component) under that id and later to look up
* that information once an {@link ExchangeResult} is available.
*/
@@ -553,7 +553,7 @@ public interface WebTestClient {
/**
* Specify the URI for the request using a URI template and URI variables.
* <p>If a {@link UriBuilderFactory} was configured for the client (e.g.
* <p>If a {@link UriBuilderFactory} was configured for the client (for example,
* with a base URI) it will be used to expand the URI template.
* @return spec to add headers or perform the exchange
*/
@@ -561,7 +561,7 @@ public interface WebTestClient {
/**
* Specify the URI for the request using a URI template and URI variables.
* <p>If a {@link UriBuilderFactory} was configured for the client (e.g.
* <p>If a {@link UriBuilderFactory} was configured for the client (for example,
* with a base URI) it will be used to expand the URI template.
* @return spec to add headers or perform the exchange
*/
@@ -875,13 +875,13 @@ public interface WebTestClient {
/**
* Consume and decode the response body to {@code byte[]} and then apply
* assertions on the raw content (e.g. isEmpty, JSONPath, etc.)
* assertions on the raw content (for example, isEmpty, JSONPath, etc.).
*/
BodyContentSpec expectBody();
/**
* Exit the chained flow in order to consume the response body
* externally, e.g. via {@link reactor.test.StepVerifier}.
* externally, for example, via {@link reactor.test.StepVerifier}.
* <p>Note that when {@code Void.class} is passed in, the response body
* is consumed and released. If no content is expected, then consider
* using {@code .expectBody().isEmpty()} instead which asserts that
@@ -927,7 +927,7 @@ public interface WebTestClient {
<T extends S> T value(Matcher<? super B> matcher);
/**
* Transform the extracted the body with a function, e.g. extracting a
* Transform the extracted the body with a function, for example, extracting a
* property, and assert the mapped value with a {@link Matcher}.
* @since 5.1
*/

View File

@@ -190,7 +190,7 @@ class WiretapConnector implements ClientHttpConnector {
}
if (!this.hasContentConsumer) {
// Couple of possible cases:
// 1. Mock server never consumed request body (e.g. error before read)
// 1. Mock server never consumed request body (for example, error before read)
// 2. FluxExchangeResult: getResponseBodyContent called before getResponseBody
//noinspection ConstantConditions
(this.publisher != null ? this.publisher : this.publisherNested)

View File

@@ -355,7 +355,7 @@ public final class MockMvcTester {
* <p>Use only this method if you need to provide a custom
* {@link RequestBuilder}. For regular cases, users should initiate the
* configuration of the request using one of the methods available on
* this instance, e.g. {@link #get()} for HTTP GET.
* this instance, for example, {@link #get()} for HTTP GET.
* <p>Contrary to {@link MockMvc#perform(RequestBuilder)}, this does not
* throw an exception if the request fails with an unresolved exception.
* Rather, the result provides the exception, if any. Assuming that a

View File

@@ -130,7 +130,7 @@ public interface MockMvcWebTestClient {
* including HTTP status, headers, and body. That is all that is available
* when making a live request over HTTP. However when the server is
* {@link MockMvc}, many more assertions are possible against the server
* response, e.g. model attributes, flash attributes, etc.
* response, for example, model attributes, flash attributes, etc.
*
* <p>Example:
* <pre class="code">

View File

@@ -195,7 +195,7 @@ public abstract class MockMvcRequestBuilders {
}
/**
* Alternative factory method that allows for custom HTTP verbs (e.g. WebDAV).
* Alternative factory method that allows for custom HTTP verbs (for example, WebDAV).
* @param httpMethod the HTTP method
* @param uri the URI
* @since 4.3

View File

@@ -136,7 +136,7 @@ public interface ConfigurableMockMvcBuilder<B extends ConfigurableMockMvcBuilder
/**
* Add a {@code MockMvcConfigurer} that automates MockMvc setup and
* configures it for some specific purpose (e.g. security).
* configures it for some specific purpose (for example, security).
* <p>There is a built-in {@link SharedHttpSessionConfigurer} that can be
* used to re-use the HTTP session across requests. 3rd party frameworks
* like Spring Security also use this mechanism to provide configuration

View File

@@ -22,12 +22,12 @@ import org.springframework.web.context.WebApplicationContext;
/**
* Contract for customizing a {@code ConfigurableMockMvcBuilder} in some
* specific way, e.g. a 3rd party library that wants to provide shortcuts for
* specific way, for example, a 3rd party library that wants to provide shortcuts for
* setting up a MockMvc.
*
* <p>An implementation of this interface can be plugged in via
* {@link ConfigurableMockMvcBuilder#apply} with instances of this type likely
* created via static methods, e.g.:
* created via static methods, for example:
*
* <pre class="code">
* import static org.example.ExampleSetup.mySetup;

View File

@@ -66,13 +66,13 @@ final class MockMvcFilterDecorator implements Filter {
private final boolean hasPatterns;
/** Patterns that require an exact match, e.g. "/test" */
/** Patterns that require an exact match, for example, "/test". */
private final List<String> exactMatches = new ArrayList<>();
/** Patterns that require the URL to have a specific prefix, e.g. "/test/*" */
/** Patterns that require the URL to have a specific prefix, for example, "/test/*". */
private final List<String> startsWithMatches = new ArrayList<>();
/** Patterns that require the request URL to have a specific suffix, e.g. "*.html" */
/** Patterns that require the request URL to have a specific suffix, for example, "*.html". */
private final List<String> endsWithMatches = new ArrayList<>();

View File

@@ -285,7 +285,7 @@ public class StandaloneMockMvcBuilder extends AbstractMockMvcBuilder<StandaloneM
/**
* Sets up a single {@link ViewResolver} that always returns the provided
* view instance. This is a convenient shortcut if you need to use one
* View instance only -- e.g. rendering generated content (JSON, XML, Atom).
* View instance only -- for example, rendering generated content (JSON, XML, Atom).
*/
public StandaloneMockMvcBuilder setSingleView(View view) {
this.viewResolvers = Collections.<ViewResolver>singletonList(new StaticViewResolver(view));