title: Service not injected for inline plugin tests in Grails
body: <p>My goal is to write test for my own Grails plugin. steps taken so far:</p>
  
  <ol>
  <li>Step  - Create separate grails app (in our case, testApp) inside
  the Grails Plugin 'test' folder </li>
  <li><p>Step - Make the plugin to be
  inline for the application - testApp by adding following Line in BuildConfig.groovy</p>
  
  <p><code>grails.plugin.location.PluginName = '../../../../PluginName'</code></p></li>
  </ol>
  
  <p>The issue is that in the Unit test, the Service (from the inline plugin) are not injected like it is for regular app in Unit Test. Here is sample test:</p>
  
  <pre><code>@TestFor(SampleService)
  class SampleServiceUnitSpec extends UnitSpec {
      def "Sample Test"(){
          setup:
             def test = 'ok'
  
          when:
             test = "changed"
  
          then:
             assert service
             assert "changed" == test
      }
  }
  </code></pre>
  
  <p>The service is injected if this test is run from grails app and service is part of the app. The service is not injected if this test is run from the testApp with inline plugin containing the service. The service is not injected if the test is plugin unit test and the service declared in the plugin.</p>
  
  <p>How to inject service so it can be tested? Any good docs,posts.etc on how best test Grails plugins? Thank You</p>