前言
Postman是一款强大的接口测试工具。
一、编写接口
@PostMapping("/studentScore")
@ResponseBody
private String studentScore(@RequestBody StudentScore studentScore, @RequestParam("flag") Boolean flag) throws Exception {
System.out.println(studentScore);
System.out.println(flag);
return "success";
}
二、测试
1.编写测试案例
2.控制台输出
代码如下(示例):
StudentScore{id=100, studentId=123, curriculumId=456, score=100}
true
总结
个人感觉flag
字段放到StudentScore
对象中会比较方便处理;
回到顶部