I get error when running unit test using a code where this part with CaseBuilder() is used in the list().
new CaseBuilder()
.when((((vTVw.value.abs().goe(20)))
.or(null)))
.then(1)
.otherwise(0)
.sum()
Here is the part from error:
Caused by: org.h2.jdbc.JdbcSQLException: SUM or AVG on wrong data type for "SUM(CASE WHEN (ABS(T_VW.VALUE) >= ?1) THEN ?2 ELSE ?3 END)"; SQL statement:
When I remove sum() there is no error. Also the same code works fine in the main production code, but fails only in unit test run. What am I missing here? I tried coalesce, but it didn't work. I searched for the error message online but couldn't find anything related to my case.