Groovy は初めてで、アプリケーションに Spock フレームワークを実装しようとしています。ここに私のテストコードがあります:
def "Test class with mock object"() {
setup:
SomeObject sp = Mock()
test= TestClass()
when:
System.out.println('comes here');
push.exec(sp)
then:
sp.length == 1
}
TestClass
これは、テストメソッドでキャッチするか、再度スローする必要がある例外をスローしています。私は試した
try {
push.exec(sp)
} catch (Exception e) {
}
しかし、まだ得ています
groovy.lang.MissingMethodException: No signature of method: test.spock.TestClassTest.TestClass() is applicable for argument types: () values: []
Possible solutions: use([Ljava.lang.Object;), use(java.util.List, groovy.lang.Closure), use(java.lang.Class, groovy.lang.Closure), dump(), with(groovy.lang.Closure), each(groovy.lang.Closure)