title: Mockito NullPointerException on mocked object
body: <p>I have this classes:</p>
  
  <pre><code>public class MyClass(){
  
     private Logger logger;
  
     @Override
     public void prepare(Map map, TopologyContext topologyContext, OutputCollector outputCollector) {
       this.collector = outputCollector;
       logger = LoggerFactory.getLogger(MyClass.class);
     }
  
      @Override
      public void execute(Tuple tuple) {
          if (TupleHelpers.isTickTuple(tuple)) {
              logger.info("Received tick tuple, triggering emit of current window counts");
          emitCurrentWindowAvgs();
  
          } else {
  
               ...
          }
      }
  }
  </code></pre>
  
  <p>I want test it with Mockito in this way:</p>
  
  <pre><code>@RunWith(MockitoJUnitRunner.class)
  public class MyClassTest {
  
   @Mock
   private Logger logger;
  
   @InjectMock
   private MyClass myclass;
  
   @Test
   public void myTest(){
        Tuple tickTuple = MockTupleHelpers.mockTickTuple();
        Myclass myclass = new MyClass();
  
      // when
      myClass.execute(tickTuple);
  
      // then
      // verifyZeroInteractions(collector);
      verify(collector).emit(any(Values.class));
  }
  </code></pre>
  
  <p>However I obtain NullPointerException on <code>logger.info("...")</code>.</p>
  
  <p>I also tried to add <code>doNothing().when(logger).info(anyString())</code> but the result does not change.</p>
  
  <p>I searched it but in most cases the problem is the initialization of the mocked object.</p>