【发布时间】:2015-01-08 06:40:01
【问题描述】:
我有一个控制器,它有很多动作。在动作内部,它正在调用驻留在同一类中的其他方法。我如何模拟这些方法以使其返回我想要的。
SomeController{
def action1={
method1() //i want to mock this method. this is not a service method
}
public def method1(){
//some code here
}
def action2={
method2() // i want to mock this method
}
public def method2(){
//some code here
}
}// SomeController
我想模拟 method1() 和 method2() 这样它应该返回我定义的东西。 提前感谢您的帮助!
【问题讨论】:
标签: unit-testing grails junit