public class ContentResult extends GenericContentResult<String>
content, resultActionsmockResponse| Constructor and Description |
|---|
ContentResult(MockResponse mockResponse,
org.springframework.test.web.servlet.ResultActions resultActions,
String content) |
| Modifier and Type | Method and Description |
|---|---|
ContentResult |
is(int expectedSize)
如果响应内容为列表数据,则校验数据量
|
ContentResult |
is(String expectedContent)
校验响应内容
|
ContentResult |
is(String jsonPathExpression,
Object expectedValue)
校验表达式对应的值
|
ContentResult |
isMatch(Pattern expectedContentPattern)
根据正则,校验响应内容格式
|
ContentResult |
isMatch(String expectedContentPattern)
根据匹配串,校验响应内容格式
|
isendpublic ContentResult(MockResponse mockResponse, org.springframework.test.web.servlet.ResultActions resultActions, String content)
public ContentResult is(String expectedContent)
expectedContent - 预期响应内容public ContentResult is(String jsonPathExpression, Object expectedValue)
jsonPathExpression - JSON路径表达式,详情见开源项目:JsonPathexpectedValue - 预期值public ContentResult is(int expectedSize)
expectedSize - 预期的列表数据数量public ContentResult isMatch(String expectedContentPattern)
expectedContentPattern - 预期响应内容格式,可以是正则,也可以是简易匹配串public ContentResult isMatch(Pattern expectedContentPattern)
expectedContentPattern - 预期响应内容格式正则Copyright © 2021–2022 EasyJ????. All rights reserved.