类 JsonExpectationsHelper

java.lang.Object
cn.taketoday.test.util.JsonExpectationsHelper

public class JsonExpectationsHelper extends Object
A helper class for assertions on JSON content.

Use of this class requires the JSONassert library.

从以下版本开始:
4.0
作者:
Sebastien Deleuze
  • 构造器概要

    构造器
    构造器
    说明
     
  • 方法概要

    修饰符和类型
    方法
    说明
    void
    assertJsonEqual(String expected, String actual)
    Parse the expected and actual strings as JSON and assert the two are "similar" - i.e. they contain the same attribute-value pairs regardless of formatting with lenient checking (extensible content and non-strict array ordering).
    void
    assertJsonEqual(String expected, String actual, boolean strict)
    Parse the expected and actual strings as JSON and assert the two are "similar" - i.e. they contain the same attribute-value pairs regardless of formatting.
    void
    assertJsonNotEqual(String expected, String actual)
    Parse the expected and actual strings as JSON and assert the two are "not similar" - i.e. they contain different attribute-value pairs regardless of formatting with a lenient checking (extensible, and non-strict array ordering).
    void
    assertJsonNotEqual(String expected, String actual, boolean strict)
    Parse the expected and actual strings as JSON and assert the two are "not similar" - i.e. they contain different attribute-value pairs regardless of formatting.

    从类继承的方法 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 构造器详细资料

    • JsonExpectationsHelper

      public JsonExpectationsHelper()
  • 方法详细资料

    • assertJsonEqual

      public void assertJsonEqual(String expected, String actual) throws Exception
      Parse the expected and actual strings as JSON and assert the two are "similar" - i.e. they contain the same attribute-value pairs regardless of formatting with lenient checking (extensible content and non-strict array ordering).
      参数:
      expected - the expected JSON content
      actual - the actual JSON content
      抛出:
      Exception
      另请参阅:
    • assertJsonEqual

      public void assertJsonEqual(String expected, String actual, boolean strict) throws Exception
      Parse the expected and actual strings as JSON and assert the two are "similar" - i.e. they contain the same attribute-value pairs regardless of formatting.

      Can compare in two modes, depending on the strict parameter value:

      • true: strict checking. Not extensible and strict array ordering.
      • false: lenient checking. Extensible and non-strict array ordering.
      参数:
      expected - the expected JSON content
      actual - the actual JSON content
      strict - enables strict checking if true
      抛出:
      Exception
    • assertJsonNotEqual

      public void assertJsonNotEqual(String expected, String actual) throws Exception
      Parse the expected and actual strings as JSON and assert the two are "not similar" - i.e. they contain different attribute-value pairs regardless of formatting with a lenient checking (extensible, and non-strict array ordering).
      参数:
      expected - the expected JSON content
      actual - the actual JSON content
      抛出:
      Exception
      另请参阅:
    • assertJsonNotEqual

      public void assertJsonNotEqual(String expected, String actual, boolean strict) throws Exception
      Parse the expected and actual strings as JSON and assert the two are "not similar" - i.e. they contain different attribute-value pairs regardless of formatting.

      Can compare in two modes, depending on strict parameter value:

      • true: strict checking. Not extensible, and strict array ordering.
      • false: lenient checking. Extensible, and non-strict array ordering.
      参数:
      expected - the expected JSON content
      actual - the actual JSON content
      strict - enables strict checking
      抛出:
      Exception