title: Stubbing of mockito mock object on spock-based test
body: <p>I'm using Spock fw with Mockito. I have a controller named 'HostController' and a service named 'HostService'.</p>
  
  <p>The 'HostController' has the method called as <code>host(Long id)</code> and 'HostService' has the method called as <code>findOne(Long id)</code>.</p>
  
  <p>I want to test <code>HostController#host(Long id)</code>, so I think of stubbing <code>findOne(Long id)</code> method.</p>
  
  <p>Follow is test code:</p>
  
  <pre><code>class MockTest extends Specification {
      @Mock
      private HostService mockedService;
  
      @InjectMocks
      private HostController controller;
  
      def setup() {
          MockitoAnnotations.initMocks(this);
      }
  
      def "mock test"() {
          given:
          def host = new Host(id: 1, ipAddress: "127.0.0.1", hostName: "host1")
          mockedService.findOne(_) &gt;&gt; host
  
          when:
          Map&lt;String, Object&gt; result = controller.host(1)
  
          then:
          result.get("host") != null
      }
  }
  </code></pre>
  
  <p>In above test, <code>controller.host(1)</code> return <code>Map&lt;String, Object&gt;</code> type and it has the key named <code>host</code>. I assumed that the key hasn't null value, but it has null value.</p>
  
  <p>Why doesn't work as I think?</p>