我正在寻找 then() 方法在 REST-assured API 中的作用的正式定义,但在 javadoc 中找不到方法解释。它有什么作用?
引用: http://static.javadoc.io/io.rest-assured/rest-assured/3.0.7/io/restassured/RestAssured.html
最佳答案
Get 返回一个 Response
对象:http://static.javadoc.io/io.rest-assured/rest-assured/3.0.7/io/restassured/response/Response.html
Response继承以下接口(interface):ResponseBody、ResponseBodyData、ResponseBodyExtractionOptions、ResponseOptions、Validatable
then
是唯一的Validatable
方法:http://static.javadoc.io/io.rest-assured/rest-assured/3.0.7/io/restassured/response/Validatable.html
但是,这通过使用 ValidatableResponseOptions 驱动了大部分事件驱动的验证:http://static.javadoc.io/io.rest-assured/rest-assured/3.0.7/io/restassured/response/ValidatableResponseOptions.html
在测试类中,这允许您编写专门用于验证休息端点的测试,而不必对 RestResponse 进行相对更困惑的解包来评估响应的各个部分。
关于java - then() 方法在 REST-assured 中做什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50455487/