这个错误的原因是什么,我该如何解决?
乍一看,这似乎是 groovy 编译器的一个缺陷。
:compileIntegrationTestGroovystartup failed:
C:\src\my-project\src\integration-test\groovy\my\project\MyServiceISpec.groovy: 31: The method setup should be public as it implements the corresponding method from interface my.project.MyTrait
. At [31:5] @ line 31, column 5.
public void setup() {
^
1 error
我的 grails 集成测试如下所示:
@Integration
@Rollback
class MyServiceISpec extends Specification implements MyTrait {
@Autowired
MyService service
OtherService otherService = Mock()
public void setup() {
myTraithMethod()
service.otherService = otherService
}
}
我的性格是这样的:
trait MyTrait {
public void setup() {
myTraithMethod()
}
private myTraitMethod() {
...
}
}
更新public
为特征设置方法添加了关键字。