Class JsonContent

java.lang.Object
org.springframework.test.json.JsonContent
All Implemented Interfaces:
org.assertj.core.api.AssertProvider<JsonContentAssert>

public final class JsonContent extends Object implements org.assertj.core.api.AssertProvider<JsonContentAssert>
JSON content which is generally used to provide JsonContentAssert to AssertJ assertThat calls.
Since:
6.2
Author:
Phillip Webb, Diego Berrueta
  • Constructor Details

    • JsonContent

      public JsonContent(String json, @Nullable HttpMessageContentConverter contentConverter)
      Create a new JsonContent instance with the message converter to use to deserialize content.
      Parameters:
      json - the actual JSON content
      contentConverter - the content converter to use
    • JsonContent

      public JsonContent(String json)
      Create a new JsonContent instance.
      Parameters:
      json - the actual JSON content
  • Method Details

    • assertThat

      public JsonContentAssert assertThat()
      Use AssertJ's assertThat instead.
      Specified by:
      assertThat in interface org.assertj.core.api.AssertProvider<JsonContentAssert>
    • getJson

      public String getJson()
      Return the actual JSON content string.
    • toString

      public String toString()
      Overrides:
      toString in class Object