Skip to content

Commit cd86902

Browse files
committed
Polishing in RestTestClient AssertJ support
See gh-35701
1 parent 1250028 commit cd86902

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,21 @@
3535
*/
3636
public class CookieMapAssert extends AbstractMapAssert<CookieMapAssert, Map<String, Cookie>, String, Cookie> {
3737

38+
3839
public CookieMapAssert(Cookie[] actual) {
39-
super(mapCookies(actual), CookieMapAssert.class);
40+
super(toMap(actual), CookieMapAssert.class);
4041
as("Cookies");
4142
}
4243

43-
private static Map<String, Cookie> mapCookies(Cookie[] cookies) {
44+
private static Map<String, Cookie> toMap(Cookie[] cookies) {
4445
Map<String, Cookie> map = new LinkedHashMap<>();
4546
for (Cookie cookie : cookies) {
4647
map.putIfAbsent(cookie.getName(), cookie);
4748
}
4849
return map;
4950
}
5051

52+
5153
/**
5254
* Verify that the actual cookies contain a cookie with the given {@code name}.
5355
* @param name the name of an expected cookie

spring-test/src/main/java/org/springframework/test/web/servlet/client/ExchangeResult.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ public byte[] getResponseBodyContent() {
203203

204204
/**
205205
* Return a {@link JsonConverterDelegate} based on the configured HTTP message converters.
206-
* Mainly for internal use from AssertJ support.
206+
* Mainly for internal use from AssertJ support classes.
207207
*/
208-
public @Nullable JsonConverterDelegate getConverterDelegate() {
208+
public @Nullable JsonConverterDelegate getJsonConverterDelegate() {
209209
return this.converterDelegate;
210210
}
211211

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ public ExchangeResult getExchangeResult() {
4040
}
4141

4242
/**
43-
* Use AssertJ's {@link org.assertj.core.api.Assertions#assertThat assertThat}
44-
* instead.
43+
* Use AssertJ's {@link org.assertj.core.api.Assertions#assertThat assertThat} instead.
4544
*/
4645
@Override
4746
public RestTestClientResponseAssert assertThat() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ public RestTestClientResponseAssert hasBodyTextEqualTo(String bodyText) {
342342
* </code></pre>
343343
*/
344344
public AbstractJsonContentAssert<?> bodyJson() {
345-
return new JsonContentAssert(new JsonContent(readBody(), getExchangeResult().getConverterDelegate()));
345+
return new JsonContentAssert(new JsonContent(readBody(), getExchangeResult().getJsonConverterDelegate()));
346346
}
347347

348348
private String readBody() {

0 commit comments

Comments
 (0)