gpt4 book ai didi

java - 使用 Spring 测试 lambda express 出现异常

转载 作者:行者123 更新时间:2023-11-30 08:11:20 28 4
gpt4 key购买 nike

我有一个 DAO 实现,它使用 Lambada 表达式,如下所示:

public RowMapper<User> getRowMapper() {
return (rs, rowNum) -> {
User result = new User();

result.setUid(rs.getInt("uid"));

return result;
};
}

当我使用gradle build时,异常消息显示如下:

ParseException in STDIN
Last useful checkpoint: "com.xx.daoimpl.MyDaoImpl.getRowMapper()"
Encountered " "," ", "" at line 61, column 27.
Was expecting one of:
"instanceof" ...
")" ...
"=" ...
">" ...
"<" ...
"?" ...
"==" ...
"<=" ...
">=" ...
"!=" ...
"||" ...
"&&" ...
"++" ...
"--" ...
"+" ...
"-" ...
"*" ...
"/" ...
"&" ...
"|" ...
"^" ...
"%" ...
"+=" ...
"-=" ...
"*=" ...
"/=" ...
"&=" ...
"|=" ...
"^=" ...
"%=" ...
"<<=" ...
">>=" ...
">>>=" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
"<" ...
"<" ...
")" ...
"<" ...

它指的是(rs, rowNum)中的','。但是当我使用gradle assemble时它效果很好,这意味着测试用例时发生了一些事情使用它。我使用Spring的嵌入式数据库进行测试。

有人可以帮忙吗?

最佳答案

我不确定这是否是同一个问题,但您是否使用过 JavaNCSS?

我在使用 cobertura 时遇到了同样的错误,如所解释的 here据报道,JavaNCSS 中存在一个问题,无法与 java 8 很好地配合

希望这有帮助

关于java - 使用 Spring 测试 lambda express 出现异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30349339/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com