title: how to test grails 3 controller with services that have another services inject into them?
body: <p>In unit test cases of controllers i'm only able to inject the services that are used in the corresponding controller.But if say one         service in controller injects another service then my test cases gets failed i.e. can not invoke service method on null object.</p>
  
  <pre><code>@TestFor(MyController)
  @Mock(MyService)
  class MyControllerSpec extends Specification {
      void "test something"(){
          when:
              controller.method1();
          then:
              //something
      }
  
  }
  
  class MyController(){
      MyService myService
  
      void method1(){
          myService.serviceMethod()       
      }   
  }
  
  class MyService(){
      AnotherService anotherService
      void serviceMethod(){
          anotherService.anotherServiceMethod()
      }
  }
  
  class AnotherService(){
      void anotherServiceMethod(){
      \\something
      }
  }
  </code></pre>
  
  <p>in this case, I'm getting <strong>can not invoke "anotherServiceMethod" on null object</strong>.
  is there any way to test this type of controller? and is it a good approach  to inject a service in another service?</p>