Skip to content

Commit 3ce79c3

Browse files
committed
Polishing
1 parent cb48077 commit 3ce79c3

17 files changed

+108
-99
lines changed

spring-test/src/main/java/org/springframework/test/json/AbstractJsonContentAssert.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@
4444
import org.springframework.util.function.ThrowingBiFunction;
4545

4646
/**
47-
* Base AssertJ {@link org.assertj.core.api.Assert assertions} that can be
47+
* Base AssertJ {@linkplain org.assertj.core.api.Assert assertions} that can be
4848
* applied to a JSON document.
4949
*
50-
* <p>Support evaluating {@linkplain JsonPath JSON path} expressions and
50+
* <p>Supports evaluating {@linkplain JsonPath JSON path} expressions and
5151
* extracting a part of the document for further {@linkplain JsonPathValueAssert
5252
* assertions} on the value.
5353
*
54-
* <p>Also support comparing the JSON document against a target, using
54+
* <p>Also supports comparing the JSON document against a target, using
5555
* {@linkplain JSONCompare JSON Assert}. Resources that are loaded from
5656
* the classpath can be relative if a {@linkplain #withResourceLoadClass(Class)
57-
* class} is provided. By default, {@code UTF-8} is used to load resources
57+
* class} is provided. By default, {@code UTF-8} is used to load resources,
5858
* but this can be overridden using {@link #withCharset(Charset)}.
5959
*
6060
* @author Stephane Nicoll
@@ -85,7 +85,7 @@ public abstract class AbstractJsonContentAssert<SELF extends AbstractJsonContent
8585
/**
8686
* Create an assert for the given JSON document.
8787
* <p>Path can be converted to a value object using the given
88-
* {@linkplain GenericHttpMessageConverter json message converter}.
88+
* {@linkplain GenericHttpMessageConverter JSON message converter}.
8989
* @param json the JSON document to assert
9090
* @param jsonMessageConverter the converter to use
9191
* @param selfType the implementation type of this assert
@@ -379,12 +379,13 @@ public SELF isNotStrictlyEqualTo(Resource expected) {
379379
}
380380

381381
/**
382-
* Override the class used to load resources. Resources can be loaded from
383-
* an absolute location or relative to tpe specified class. For instance,
384-
* specifying {@code com.example.MyClass} as the resource class allows you
385-
* to use "my-file.json" to load {@code /com/example/my-file.json}.
386-
* @param resourceLoadClass the class used to load resources or {@code null}
387-
* to only use absolute paths.
382+
* Override the class used to load resources.
383+
* <p>Resources can be loaded from an absolute location or relative to the
384+
* specified class. For instance, specifying {@code com.example.MyClass} as
385+
* the resource class allows you to use "my-file.json" to load
386+
* {@code /com/example/my-file.json}.
387+
* @param resourceLoadClass the class used to load resources, or {@code null}
388+
* to only use absolute paths
388389
*/
389390
public SELF withResourceLoadClass(@Nullable Class<?> resourceLoadClass) {
390391
this.resourceLoadClass = resourceLoadClass;
@@ -393,8 +394,8 @@ public SELF withResourceLoadClass(@Nullable Class<?> resourceLoadClass) {
393394
}
394395

395396
/**
396-
* Override the {@link Charset} to use to load resources. By default,
397-
* resources are loaded using {@code UTF-8}.
397+
* Override the {@link Charset} to use to load resources.
398+
* <p>By default, resources are loaded using {@code UTF-8}.
398399
* @param charset the charset to use, or {@code null} to use the default
399400
*/
400401
public SELF withCharset(@Nullable Charset charset) {

spring-test/src/main/java/org/springframework/test/json/AbstractJsonValueAssert.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
import org.springframework.util.StringUtils;
4242

4343
/**
44-
* Base AssertJ {@link org.assertj.core.api.Assert assertions} that can be
44+
* Base AssertJ {@linkplain org.assertj.core.api.Assert assertions} that can be
4545
* applied to a JSON value.
4646
*
4747
* <p>In JSON, values must be one of the following data types:

spring-test/src/main/java/org/springframework/test/json/JsonContentAssert.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class JsonContentAssert extends AbstractJsonContentAssert<JsonContentAsse
3030
/**
3131
* Create an assert for the given JSON document.
3232
* <p>Path can be converted to a value object using the given
33-
* {@linkplain GenericHttpMessageConverter json message converter}.
33+
* {@linkplain GenericHttpMessageConverter JSON message converter}.
3434
* @param json the JSON document to assert
3535
* @param jsonMessageConverter the converter to use
3636
*/

spring-test/src/main/java/org/springframework/test/json/JsonPathValueAssert.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import org.springframework.lang.Nullable;
2323

2424
/**
25-
* AssertJ {@link org.assertj.core.api.Assert assertions} that can be applied
25+
* AssertJ {@linkplain org.assertj.core.api.Assert assertions} that can be applied
2626
* to a JSON value produced by evaluating a {@linkplain JsonPath JSON path}
2727
* expression.
2828
*

spring-test/src/main/java/org/springframework/test/web/servlet/assertj/AbstractHttpServletRequestAssert.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import org.springframework.web.context.request.async.DeferredResult;
3535

3636
/**
37-
* Base AssertJ {@link org.assertj.core.api.Assert assertions} that can be
37+
* Base AssertJ {@linkplain org.assertj.core.api.Assert assertions} that can be
3838
* applied to an {@link HttpServletRequest}.
3939
*
4040
* @author Stephane Nicoll

spring-test/src/main/java/org/springframework/test/web/servlet/assertj/AbstractHttpServletResponseAssert.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
import org.springframework.util.function.SingletonSupplier;
3737

3838
/**
39-
* Base AssertJ {@link org.assertj.core.api.Assert assertions} that can be
39+
* Base AssertJ {@linkplain org.assertj.core.api.Assert assertions} that can be
4040
* applied to any object that provides an {@link HttpServletResponse}. This
4141
* provides direct access to response assertions while also providing access to
4242
* a different top-level object.
@@ -91,7 +91,7 @@ public MediaTypeAssert contentType() {
9191
* {@link HttpHeaders} as the object to test. The returned assertion
9292
* object provides all the regular {@linkplain AbstractMapAssert map
9393
* assertions}, with headers mapped by header name.
94-
* Examples: <pre><code class='java'>
94+
* Examples: <pre><code class="java">
9595
* // Check for the presence of the Accept header:
9696
* assertThat(response).headers().containsHeader(HttpHeaders.ACCEPT);
9797
*

spring-test/src/main/java/org/springframework/test/web/servlet/assertj/AbstractMockHttpServletRequestAssert.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
import org.springframework.mock.web.MockHttpServletRequest;
2020

2121
/**
22-
* AssertJ {@link org.assertj.core.api.Assert assertions} that can be applied to
23-
* {@link MockHttpServletRequest}.
22+
* AssertJ {@linkplain org.assertj.core.api.Assert assertions} that can be applied
23+
* to {@link MockHttpServletRequest}.
2424
*
2525
* @author Stephane Nicoll
2626
* @since 6.2

spring-test/src/main/java/org/springframework/test/web/servlet/assertj/AbstractMockHttpServletResponseAssert.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ protected AbstractMockHttpServletResponseAssert(
5656
/**
5757
* Return a new {@linkplain AbstractStringAssert assertion} object that uses
5858
* the response body converted to text as the object to test.
59-
* <p>Examples: <pre><code class='java'>
59+
* <p>Examples: <pre><code class="java">
6060
* // Check that the response body is equal to "Hello World":
6161
* assertThat(response).bodyText().isEqualTo("Hello World");
6262
* </code></pre>
@@ -70,7 +70,7 @@ public AbstractStringAssert<?> bodyText() {
7070
* uses the response body converted to text as the object to test. Compared
7171
* to {@link #bodyText()}, the assertion object provides dedicated JSON
7272
* support.
73-
* <p>Examples: <pre><code class='java'>
73+
* <p>Examples: <pre><code class="java">
7474
* // Check that the response body is strictly equal to the content of
7575
* // "/com/acme/sample/person-created.json":
7676
* assertThat(response).bodyJson()
@@ -82,7 +82,7 @@ public AbstractStringAssert<?> bodyText() {
8282
* .isStrictlyEqualToJson("person-created.json");
8383
* </code></pre>
8484
* The returned assert object also supports JSON path expressions.
85-
* <p>Examples: <pre><code class='java'>
85+
* <p>Examples: <pre><code class="java">
8686
* // Check that the JSON document does not have an "error" element
8787
* assertThat(response).bodyJson().doesNotHavePath("$.error");
8888
*
@@ -114,7 +114,7 @@ public AbstractByteArrayAssert<?> body() {
114114
* Return a new {@linkplain UriAssert assertion} object that uses the
115115
* forwarded URL as the object to test. If a simple equality check is
116116
* required, consider using {@link #hasForwardedUrl(String)} instead.
117-
* <p>Example: <pre><code class='java'>
117+
* <p>Example: <pre><code class="java">
118118
* // Check that the forwarded URL starts with "/orders/":
119119
* assertThat(response).forwardedUrl().matchPattern("/orders/*);
120120
* </code></pre>
@@ -127,7 +127,7 @@ public UriAssert forwardedUrl() {
127127
* Return a new {@linkplain UriAssert assertion} object that uses the
128128
* redirected URL as the object to test. If a simple equality check is
129129
* required, consider using {@link #hasRedirectedUrl(String)} instead.
130-
* <p>Example: <pre><code class='java'>
130+
* <p>Example: <pre><code class="java">
131131
* // Check that the redirected URL starts with "/orders/":
132132
* assertThat(response).redirectedUrl().matchPattern("/orders/*);
133133
* </code></pre>

spring-test/src/main/java/org/springframework/test/web/servlet/assertj/CookieMapAssert.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
import org.assertj.core.api.Assertions;
2727

2828
/**
29-
* AssertJ {@link org.assertj.core.api.Assert assertions} that can be applied to
30-
* {@link Cookie cookies}.
29+
* AssertJ {@linkplain org.assertj.core.api.Assert assertions} that can be applied
30+
* to {@link Cookie cookies}.
3131
*
3232
* @author Brian Clozel
3333
* @author Stephane Nicoll

spring-test/src/main/java/org/springframework/test/web/servlet/assertj/DefaultMvcTestResult.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,26 @@ final class DefaultMvcTestResult implements MvcTestResult {
3939
@Nullable
4040
private final GenericHttpMessageConverter<Object> jsonMessageConverter;
4141

42-
DefaultMvcTestResult(@Nullable MvcResult mvcResult, @Nullable Exception unresolvedException, @Nullable GenericHttpMessageConverter<Object> jsonMessageConverter) {
42+
43+
DefaultMvcTestResult(@Nullable MvcResult mvcResult, @Nullable Exception unresolvedException,
44+
@Nullable GenericHttpMessageConverter<Object> jsonMessageConverter) {
45+
4346
this.mvcResult = mvcResult;
4447
this.unresolvedException = unresolvedException;
4548
this.jsonMessageConverter = jsonMessageConverter;
4649
}
4750

51+
52+
@Override
4853
public MvcResult getMvcResult() {
4954
if (this.mvcResult == null) {
5055
throw new IllegalStateException(
51-
"Request has failed with unresolved exception " + this.unresolvedException);
56+
"Request failed with unresolved exception " + this.unresolvedException);
5257
}
5358
return this.mvcResult;
5459
}
5560

61+
@Override
5662
@Nullable
5763
public Exception getUnresolvedException() {
5864
return this.unresolvedException;

0 commit comments

Comments
 (0)