类 JsonExpectationsHelper

    • 方法概要

      所有方法 实例方法 具体方法 
      修饰符和类型方法说明
      voidassertJsonEqual​(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 a lenient checking (extensible, and non-strict array ordering).
      voidassertJsonEqual​(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.
      voidassertJsonNotEqual​(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).
      voidassertJsonNotEqual​(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.
    • 方法详细资料

      • 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 a lenient checking (extensible, and non-strict array ordering).
        参数:
        expected - the expected JSON content
        actual - the actual JSON content
        抛出:
        Exception
        从以下版本开始:
        4.1
        另请参阅:
        assertJsonEqual(String, String, boolean)
      • 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 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
        从以下版本开始:
        4.2
      • 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
        从以下版本开始:
        4.1
        另请参阅:
        assertJsonNotEqual(String, String, boolean)
      • 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
        从以下版本开始:
        4.2