groovy spock mocking spring autowired beans
问题 I have bean: @Service public class EQueueBookingService { @Autowired public EQueueBookingClient eQueueBookingClient; And I try to write some test for this bean EQueueBookingService using Spock. https://code.google.com/p/spock/wiki/SpockBasics My mock is class EQueueBookingServiceTest extends Specification { @Autowired EQueueBookingService testedService; EQueueBookingClient eQueueBookingClient = Mock(EQueueBookingClient); def setup() { testedService.eQueueBookingClient = eQueueBookingClient; }