Mocking and stubbing of the same invocation need to happen together (either in the given
or then
block):
...
then:
1 * bundle.getName() >> "name"
1 * bundle.getVersion() >> "1.0.0"
x == "name: 1.0.0"
Combining Mocking and Stubbing in the Spock Reference Documentation explains this in more detail.
An alternative is to get rid of the mocking part (1 * bundle.getName()
etc.), which may not be all that necessary/helpful here.