【发布时间】:2018-02-21 11:03:02
【问题描述】:
下面的代码 sn-p 是我的 Groovy 类的单元测试用例代码。
在 Eclipse Luna 中使用 maven build 运行此测试用例时出现以下错误:
错误: [错误] com.double.example.application.appMockTest#testUserList MissingMethodException
你们中的任何人都可以对此有所了解吗?如何解决这个问题?
注意:网上讨论很少,但没有任何结果。
public void testUserList() {
setup()
def userList = [['name':'12345678', 'actual_name':'Paul allan']]
List<User> tempList = new ArrayList<User>()
mocksql.demand.eachrow {
def query, closure -> userList.each(closure)
}
mocksql.use {
apply1 = new apply1(
<connection string goes here>,
<username>, <password>,
<schemaname>,
"oracle.jdbc.driver.OracleDriver")
tempList = apply1.getapply1UserList()
}
}
}
【问题讨论】:
-
完整的堆栈跟踪是否指向特定的行?还有mocksql是什么类的实例?
-
mocksql 是 Sql 类的一个实例,是的,完整的堆栈跟踪指向该行上的特定行 (mocksql.use{})
标签: unit-testing groovy mocking