我找不到任何地方描述的这个问题,因此我向其他发现此问题的人发帖。
我发现使用'>>'或'>>>'运行任何spock存根示例均失败,但有相同的例外。MissingMethodException: No signature of method: org.spockframework.mock.runtime.InteractionBuilder.setArgListKind() is applicable for argument types: (Boolean, Boolean) values: [true, false]
例如,来自Javitar: Spock Testing – Spock tutorial
def "should return Role.USER when asked for role"() {
given:
List list = Stub()
list.size() >> 3
expect:
// let's see if this works
list.size() == 3
}
因此Intellij使用Junit模板运行Spock测试。我在这里找到解决方案:Combining Spock 1.2 and Junit 5 tests解决方案是将以下内容添加到我的build.gradle中:
dependencies {
implementation "org.junit.jupiter:junit-jupiter-api:5.6.1"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:5.6.1"
}
test { // only needed if doing 'gradle test'
useJUnitPlatform()
}
我正在使用Intellij / Idea 2019.3运行此代码
------------------------------------------------------------
Gradle 6.2.2
------------------------------------------------------------
Build time: 2020-03-04 08:49:31 UTC
Revision: 7d0bf6dcb46c143bcc3b7a0fa40a8e5ca28e5856
Kotlin: 1.3.61
Groovy: 2.5.8
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 1.8.0_152 (Azul Systems, Inc. 25.152-b16)
OS: Linux 4.15.0-52-generic amd64
Linux Mint 19 Tara