drools8尝试(加单元测试)

drools8的maven模板项目里没有单元测试, 相比而言drools7有个非常好的test senorios

那就自己弄一个

文件是.http后缀的,写了个简单的例子如下

powershell 复制代码
//测试交通违章
POST  http://localhost:8080/Traffic Violation
accept: application/json
Content-Type: application/json

{
  "Violation": {
    "Code": "zzfdsfz",
    "Date": "2023-08-23",
    "Type": "speed",
    "Speed Limit": 10,
    "Actual Speed": 100
  },
  "Driver": {
    "Name": "string",
    "Age": 0,
    "State": "string",
    "City": "string",
    "Points": 0
  }
}

> {%
// 这块是对结果的测试
client.test("Request executed successfully", function() {
  client.assert(response.status === 200, "Response status is not 200");
  //client.assert(response.status === 203, "Response status is  200");
  //意思是说,罚金恒等于1000  否则报错"罚金计算错误"
  client.assert(response.body.Fine.Amount === 1000, "罚金计算错误");

});
%}

感觉还不错

下一步应用到k8s里,或者是看原生的微服务是什么东西

相关推荐
j7~16 小时前
【C++ 标准项目】发布订阅消息队列 (篇七):项目创建与基础工具模块搭建
开发语言·c++·log4j·uuid·protobuf·helper工具·消息定义类型和交换机类型定义
楚楚2511 天前
2026最新6款Cursor平替AI编程工具深度实测对比
log4j
回眸&啤酒鸭2 天前
【回眸】自动化白盒测试落地实战指南
运维·自动化·log4j
网络毒刘3 天前
端到端:用 Cursor Agent 完成「小功能 + 单测 + PR 描述」并附人工验收清单
单元测试·agent·ai编程·cursor·工具实践
mont evergreen3 天前
RTMP 连接单元测试之旅
单元测试·音视频·源码解读
我就是不信4 天前
CuTest:轻量级 C 语言单元测试框架实战指南
c语言·单元测试·log4j
虫无涯8 天前
Coverity 如何结合 GJB8114-2013使用?
git·单元测试·嵌入式测试·coverity·静态扫描
zlpzlpzyd8 天前
log4j2各个标签以及属性的含义
log4j
茉莉玫瑰花茶10 天前
GO [ 单元测试 ]
golang·单元测试·log4j
李游Leo11 天前
HarmonyOS 7 + ArkUI-Hvigor:动态字体与色彩对比上架预检【鸿蒙心迹】
华为·log4j·harmonyos