Interface WebTestClient.BodySpec<B, S extends WebTestClient.BodySpec<B,S>>

Type Parameters:
B - the body type
S - a self reference to the spec type
All Known Subinterfaces:
WebTestClient.ListBodySpec<E>
Enclosing interface:
WebTestClient

public static interface WebTestClient.BodySpec<B, S extends WebTestClient.BodySpec<B,S>>
Spec for expectations on the response body decoded to a single Object.
Since:
5.0
Author:
Rossen Stoyanchev, Brian Clozel, Sam Brannen, MichaƂ Rowicki
  • Method Details

    • isEqualTo

      <T extends S> T isEqualTo(@Nullable B expected)
      Assert the extracted body is equal to the given value.
    • value

      <T extends S> T value(Matcher<? super @Nullable B> matcher)
      Assert the extracted body with a Matcher.
      Since:
      5.1
    • value

      <T extends S, R> T value(Function<@Nullable B, @Nullable R> bodyMapper, Matcher<? super @Nullable R> matcher)
      Transform the extracted the body with a function, for example, extracting a property, and assert the mapped value with a Matcher.
      Since:
      5.1
    • value

      <T extends S> T value(Consumer<@Nullable B> consumer)
      Assert the extracted body with a Consumer.
      Since:
      5.1
    • consumeWith

      <T extends S> T consumeWith(Consumer<EntityExchangeResult<B>> consumer)
      Assert the exchange result with the given Consumer.
    • returnResult

      EntityExchangeResult<B> returnResult()
      Exit the chained API and return an ExchangeResult with the decoded response content.