我正在为 Web 应用程序编写 spock 测试,最近才开始出现此错误:
java.lang.IllegalStateException: can not found call #0 on stack. Invalid
call of record method? at Test.Simple Test(Test.groovy:8)
即使我进行了简单的健全性检查(如下所示(,我仍然会收到此错误。它告诉我错误来自"then"子句之后的任何内容。
import spock.lang.Specification
class Test extends Specification {
def "Simple Test"() {
when:
def x = 1
then:
x
}
}
任何帮助将不胜感激!
经过多次环顾四周,我能够找到解决方案。这个项目是一个多项目的gradle构建,我发现父项目与测试所在的子项目有一个冲突的testCompile spock依赖项。
感谢所有关注这个问题的人!