grails - 单独运行时带有子句'in'的集成测试会导致错误
问题描述
我有一个集成(h2、spock、grails-2.5.5)测试,在 sql(gorm)咨询中运行。当一起运行所有测试“grails test-app”时,此测试工作正常,但是当我单独运行时,测试中断并显示以下错误:
count_subscriber_brands subscriber6_ on br2_.id=subscriber6_.brand_id left outer join account_subscriber brs3_ on subscriber6_.account_subscriber_id=brs3_.id left outer join account brs3_1_ on brs3_.id=brs3_1_.id left outer join product_subscriber_publish sp1_ on this_.id=sp1_.product_id where this_.gtin=? and ((sp1_.subscriber_id=? and sp1_.is_published=?) or (this_.status in (?, ?) and ((br2_.exclusive=? and brs3_.id=?) or br2_.exclusive is null or br2_.exclusive=?))) [22018-176]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:344)
at org.h2.message.DbException.get(DbException.java:167)
at org.h2.value.Value.convertTo(Value.java:902)
at org.h2.expression.ConditionIn.getValue(ConditionIn.java:57)
at org.h2.expression.ConditionAndOr.getValue(ConditionAndOr.java:87)
at org.h2.expression.ConditionAndOr.getValue(ConditionAndOr.java:110)
at org.h2.expression.ConditionAndOr.getValue(ConditionAndOr.java:94)
at org.h2.expression.Expression.getBooleanValue(Expression.java:179)
at org.h2.command.dml.Select.queryFlat(Select.java:535)
at org.h2.command.dml.Select.queryWithoutCache(Select.java:646)
at org.h2.command.dml.Query.query(Query.java:323)
at org.h2.command.dml.Query.query(Query.java:291)
at org.h2.command.dml.Query.query(Query.java:37)
at org.h2.command.CommandContainer.query(CommandContainer.java:91)
at org.h2.command.Command.executeQuery(Command.java:197)
at org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:109)
... 7 more
Caused by: java.lang.NumberFormatException: For input string: "INACTIVATED"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at java.lang.Integer.parseInt(Integer.java:615)
at org.h2.value.Value.convertTo(Value.java:852)
... 20 more
gorm 子句包含 'in'('status', [FINE, WORK, INACTIVATED])
当我单独运行时,测试也很好
解决方案
推荐阅读
- excel - Excel VBA - 在类模块中输入
- sql-server - 我有从存储过程写入控制台的代码,但是我想写入文本文件/Excel
- flutter - onTap 不适用于多边形/谷歌地图颤振
- ansible - 如何在ansible中修改深度字典中的多个值
- javascript - 如何使用来自第一个 API 调用的数据进行进一步的 API 调用?
- javascript - 闪亮的自定义悬停下拉菜单
- postgraphile - 如何在 Postgraphile 插件中根据上下文添加 where 条件?
- javascript - Material UI,内部链接滚动在移动设备上不起作用
- css - 我如何在 bootstrap 4.6.0 中使用 glyphico-search。我在课堂上使用 span
- javascript - AmplitudeJS:如何显示当前歌曲的持续时间?