title: Tests Run fine in Eclipse but failed in mvn command
body: <p>The test is very very simple test </p>
  
  <pre><code>@RunWith(MockitoJUnitRunner.class)
  public class UnitTestMyCode {
  
    @InjectMocks
    private MyClass resource;
  
    @Mock
    private DependentBean bean;
  
    @Test
    public void test1() throws Exception {
      boolean ss = true;
      assertThat(ss).isTrue();
  }
  </code></pre>
  
  <p><strong>Error</strong></p>
  
  <pre><code>org.mockito.exceptions.base.MockitoException: Field 'resource' annotated with @InjectMocks is null.
  Please make sure the instance is created *before* MockitoAnnotations.initMocks();
  Example of correct usage:
     class SomeTest {
        @InjectMocks private Foo foo = new Foo();
  
        @Before public void setUp() {
           MockitoAnnotations.initMock(this);
  
      at org.mockito.internal.runners.JUnit45AndHigherRunnerImpl$1.withBefores(JUnit45AndHigherRunnerImpl.java:27)
      at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:276)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
  </code></pre>
  
  <p>Surefire plugin Config</p>
  
  <pre><code>   &lt;plugin&gt;
          &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.4.2&lt;/version&gt;
          &lt;executions&gt;
            &lt;execution&gt;
              &lt;id&gt;default-test&lt;/id&gt;
              &lt;phase&gt;test&lt;/phase&gt;
              &lt;goals&gt;
                &lt;goal&gt;test&lt;/goal&gt;
              &lt;/goals&gt;
              &lt;configuration&gt;
                &lt;excludes&gt;
                  &lt;exclude&gt;**/*IntegrationTest*.java&lt;/exclude&gt;
                &lt;/excludes&gt;
                &lt;includes&gt;
                  &lt;include&gt;**/*UnitTest*.java&lt;/include&gt;
                &lt;/includes&gt;
                &lt;skip&gt;false&lt;/skip&gt;
              &lt;/configuration&gt;
            &lt;/execution&gt;
          &lt;/executions&gt;
          &lt;configuration&gt;
            &lt;excludes&gt;
              &lt;exclude&gt;**/*IntegrationTest*.java&lt;/exclude&gt;
            &lt;/excludes&gt;  
            &lt;includes&gt;
                  &lt;include&gt;**/*UnitTest*.java&lt;/include&gt;
            &lt;/includes&gt;            
            &lt;skip&gt;false&lt;/skip&gt;
          &lt;/configuration&gt;
        &lt;/plugin&gt;
  </code></pre>
  
  <p>I have followed the steps at this <a href="https://stackoverflow.com/questions/3365628/junit-tests-pass-in-eclipse-but-fail-in-maven-surefire">JUnit tests pass in Eclipse but fail in Maven Surefire</a>
  But no luck.</p>
  
  <p>Any help here.</p>