java Sping Boot QR Code示例JUnit测试(集成测试和服务测试)Zxing问题(com.google.zxing.NotFoundException和400 BadRequest)

xa9qqrwz  于 2023-04-04  发布在  Java
关注(0)|答案(1)|浏览(114)

我尝试在Sping Boot 中实现QR Code Generator的示例。我在服务测试和控制器测试中遇到问题。在服务测试中,我无法解码QRCodeReader().decode(binaryBitmap)中的字节值,当我运行任何测试方法时,都会收到以下错误消息

`com.google.zxing.NotFoundException`

在控制器测试中,当我运行任何测试方法时,我得到如下所示的错误消息

MockHttpServletResponse:
Status = 400
Error message = null
Headers = [Content-Type:"application/problem+json"]
Content type = application/problem+json
Body = {"type":"about:blank","title":"Bad Request","status":400,"detail":"Required part 'text' is not present.","instance":"/api/v1/qr-generator"}
Forwarded URL = null
Redirected URL = null
Cookies = []

java.lang.AssertionError: Status expected:<201> but was:<400>
Expected :201
Actual :400

我该怎么修呢?
下面是链接:Link

c3frrgcw

c3frrgcw1#

修改虚拟数据类后,问题消失。

相关问题