title: JUnit test case with Mockito throws NullPointerException
body: <p>I am writing a JUnit test case using Mockito and I am getting a NullPointerException.</p>
  
  
  
  <p><strong>Business Code</strong></p>
  
  <pre class="lang-java prettyprint-override"><code>public XRImage getImage(String imgId, List tagList) {
      _paramsMap.printContent();
      return _paramsMap.getImage(imgId, tagList);
  }
  </code></pre>
  
  <p><strong>Test Code</strong></p>
  
  <pre class="lang-java prettyprint-override"><code>@Test
  public void getImageTest() {
      String imgId = new String("Test");
      List requiredTags = null;
      XRImage xRImage = Mockito.mock(XRImage.class);
      ImageParamsMap imageParamsMap = Mockito.mock(ImageParamsMap.class);
      imageParamsMap.addImage(imgId);
      when(imageParamsMap.getImage(imgId, requiredTags)).thenReturn(Mockito.mock(XRImage.class));
      XRImage getImage1 = acquisitionParamsManager.getImage(imgId, requiredTags);
      assertNotNull(getImage1);
  }
  </code></pre>