IntelliJ IDEA (2017.2) emits the following warning on Spock interactions that combine cardinality with a return value.
'multiply' in 'org.codehaus.groovy.runtime.DefaultGroovyMethods' cannot be applied to...
...followed by the return type of the interaction.
Neither stubs nor mocks alone emit a warning, only the combination of the two.
1 * mockDAO.deleteData()
is OK.
mockDAO.readData() >> myData
is OK.
1 * mockDAO.readData() >> myData
is a warning.
Is there any setting or syntax to make IntelliJ understand the mock/stub combination?
IntelliJ fixed this issue in version 2019.1: specifically, issue 205861. Regarding the issues mentioned in the comment from @Leonard Brünings, issue 171311 is marked as a duplicate of this; and several additional Spock issues were fixed in the same release, including 87240.