You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用H2数据库进行JUnit测试时遭遇java.lang.AssertionError求助

求助:Spring Boot+H2数据库JUnit测试抛出java.lang.AssertionError

我正在给我的Spring Boot服务编写基于H2内存数据库的JUnit测试,结果运行时一直抛出java.lang.AssertionError,折腾半天也没找到问题根源,有没有大佬能帮忙排查下?

下面是我项目里src/test/resources/test.properties的配置内容(后续部分被截断):

spring.datasource.initialize=true
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.url=jdbc:h2:mem:testdb;sql.syntax_ora=true;
spring.datasource.username=sa
spring.datasource.password=sa
spring.datasource.platform=h2
spring.dataso...

目前暂时只整理出这些配置信息,如果需要我的测试代码、实体类定义或者完整的错误堆栈信息,我马上补充上来!

内容的提问来源于stack exchange,提问作者Shaikh Mudassir

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 08:08:50