【发布时间】:2018-10-20 13:11:21
【问题描述】:
我使用 JOOQ 在我的服务类中调用计数聚合函数。
SelectQuery<Record> query = this.dsl.selectQuery();
query.addSelect(DSL.count());
query.addFrom(SOME_TABLE);
final Integer total = query.fetchOne(0, Integer.class);
我需要在单元测试中模拟计数结果。 最好的方法是什么?
在jooq documentation 之后,我必须创建具有相关字段计数的结果记录。 类似的东西:
Result<Record1<Integer>> result = create.newResult(...);
但是在为聚合函数创建模拟记录的情况下,我必须使用什么作为 create.newResult() 方法参数?
【问题讨论】:
标签: java unit-testing mocking jooq