title: Unit Testing Maven Mojo - Components and parameters are null
body: <p>Based on the documentation and mailing threads I have seen 3 ways to inject the maven project into my mojo:</p>
  
  <pre><code>/**
    * Project instance
    * 
    * @parameter default-value="${project}"
    * @required
    * @readonly
    */
  private MavenProject project;
  
  
  @Component
  private MavenProject project;
  
  
  @Parameter(  expression = "${project}" )    
  private MavenProject project;
  </code></pre>
  
  <p>But regardless of which one of these I choose, when I run the unit test based on the example I found in maven docs, project is always null.</p>
  
  <pre><code>public void testMojoGoal() throws Exception {
      File testPom = new File(getBasedir(),
              "src/test/resources/unit/basic-test/sample-sh-project-config.xml");
  
      ShunitResourcesMojo mojo = (ShunitResourcesMojo) lookupMojo("prepare",testPom);
  
      assertNotNull(mojo);
  
      mojo.execute();     
  }
  </code></pre>
  
  <p>mojo execute contains (and fails on)</p>
  
  <pre><code>Validate.notNull(project);
  </code></pre>