接口的使用
cn.taketoday.test.web.reactive.server.WebTestClient.BodyContentSpec
-
cn.taketoday.test.web.reactive.server中WebTestClient.BodyContentSpec的使用
修饰符和类型字段说明private final WebTestClient.BodyContentSpecJsonPathAssertions.bodySpecprivate final WebTestClient.BodyContentSpecXpathAssertions.bodySpec修饰符和类型方法说明private WebTestClient.BodyContentSpecXpathAssertions.assertWith(XpathAssertions.CheckedExceptionTask task) DefaultWebTestClient.DefaultBodyContentSpec.consumeWith(Consumer<EntityExchangeResult<byte[]>> consumer) WebTestClient.BodyContentSpec.consumeWith(Consumer<EntityExchangeResult<byte[]>> consumer) Assert the response body content with the givenConsumer.JsonPathAssertions.doesNotExist()XpathAssertions.doesNotExist()Delegates toXpathExpectationsHelper.doesNotExist(byte[], String).JsonPathAssertions.doesNotHaveJsonPath()JsonPathAssertions.exists()XpathAssertions.exists()Delegates toXpathExpectationsHelper.exists(byte[], String).DefaultWebTestClient.DefaultResponseSpec.expectBody()WebTestClient.ResponseSpec.expectBody()Consume and decode the response body tobyte[]and then apply assertions on the raw content (e.g. isEmpty, JSONPath, etc.)JsonPathAssertions.hasJsonPath()JsonPathAssertions.isArray()JsonPathAssertions.isBoolean()JsonPathAssertions.isEmpty()XpathAssertions.isEqualTo(boolean expectedValue) JsonPathAssertions.isMap()JsonPathAssertions.isNotEmpty()JsonPathAssertions.isNumber()default WebTestClient.BodyContentSpecParse the expected and actual response content as JSON and perform a comparison verifying that they contain the same attribute-value pairs regardless of formatting with lenient checking (extensible and non-strict array ordering).Parse the expected and actual response content as JSON and perform a comparison verifying that they contain the same attribute-value pairs regardless of formatting.XpathAssertions.nodeCount(int expectedCount) Consume the count of nodes as result of the XPath evaluation.Consume the result of the XPath evaluation as a Double.Consume the result of the XPath evaluation as a String.Consume the result of the JSONPath evaluation.Consume the result of the JSONPath evaluation and provide a target class.JsonPathAssertions.value(org.hamcrest.Matcher<? super T> matcher) Delegates toJsonPathExpectationsHelper.assertValue(String, Matcher).Parse expected and actual response content as XML and assert that the two are "similar", i.e. they contain the same elements and attributes regardless of order.限定符构造器说明(专用程序包)JsonPathAssertions(WebTestClient.BodyContentSpec spec, String content, String expression, Object... args) (专用程序包)XpathAssertions(WebTestClient.BodyContentSpec spec, String expression, Map<String, String> namespaces, Object... args)