docs(api): 更新图片篡改检测接口文档并优化测试用例
- 添加了ForgeryDetectionController接口的详细注释文档 - 补充了请求参数格式说明和接口功能描述 - 在测试用例中增加请求参数和响应结果的打印输出 - 优化了测试步骤的编号和断言语句的可读性 - 添加了JSON格式化输出便于调试和验证 - 完善了测试流程中的日志输出机制
This commit is contained in:
parent
202b951377
commit
8b4a5034b9
@ -38,6 +38,11 @@ public class ForgeryDetectionController {
|
||||
@Autowired
|
||||
private BForgeryDetectionHandle bForgeryDetectionHandle;
|
||||
|
||||
/**
|
||||
* 图片篡改检测
|
||||
* @param request: {"detectProportion":"true","detectThreshold":"0.9887","imageUrl":"https://www.opsky.com.cn/upload/20211224/KXfgvm2MFRAXKbPu5LK.png","restrictProbability":"0.8","returnHeatmap":"true"}
|
||||
* @return
|
||||
*/
|
||||
@EbAuthentication(tencent = ApiConstants.TENCENT_AUTH)
|
||||
@PostMapping("/forgeryDetection")
|
||||
public R<ForgeryDetectionResp> forgeryDetection(@RequestBody ForgeryDetectionRequest request) {
|
||||
|
||||
@ -40,15 +40,25 @@ public class ForgeryDetectionControllerTest extends ApiInterfaceApplicationTests
|
||||
request.setReturnHeatmap("true");
|
||||
request.setRestrictProbability("0.8");
|
||||
|
||||
// 2. 调用本地 /doc/forgeryDetection 接口
|
||||
// 2. 打印请求参数
|
||||
System.out.println("\n========== 请求参数 ==========");
|
||||
System.out.println(JSON.toJSONString(request));
|
||||
System.out.println("==============================");
|
||||
|
||||
// 3. 调用本地 /doc/forgeryDetection 接口
|
||||
R<ForgeryDetectionResp> result = forgeryDetectionController.forgeryDetection(request);
|
||||
|
||||
// 3. 断言
|
||||
// 4. 打印响应结果
|
||||
System.out.println("\n========== 响应结果 ==========");
|
||||
System.out.println(JSON.toJSONString(result));
|
||||
System.out.println("==============================");
|
||||
|
||||
// 5. 断言
|
||||
assertNotNull(result, "返回结果不能为空");
|
||||
assertEquals("200", result.getCode(), "接口应返回成功");
|
||||
assertNotNull(result.getData(), "返回数据不能为空");
|
||||
|
||||
// 4. 打印接口返回值
|
||||
// 6. 打印接口返回值
|
||||
ForgeryDetectionResp data = result.getData();
|
||||
String heatmapDisplay = data.getHeatmap() != null
|
||||
? data.getHeatmap().substring(0, Math.min(50, data.getHeatmap().length())) + "...(共" + data.getHeatmap().length() + "字符)"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user