0

I have an integration (h2, spock, grails-2.5.5) tests that running inside a sql (gorm) consult. This test works fine when running all tests together "grails test-app", but when i'm running individually the test broken and show me the following error:

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 clause contains 'in'('status', [FINE, WORK, INACTIVATED])

When i run individually the tests works fine too

Mister B
  • 123
  • 2
  • 15
  • it looks to me like the query `this_.status in (?, ?)` is expecting two parameters while you are passing 3...`[FINE, WORK, INACTIVATED]` and the last param `INACTIVATED` is getting put in `br2_.exclusive=?` causing `java.lang.NumberFormatException: For input string: "INACTIVATED"` – Alex Harris Jul 03 '19 at 14:29
  • this_.status in (?, ?.?) does´t work too, the number of params is irrelevant – Mister B Jul 03 '19 at 19:09

0 Answers0