title: Mockito when()...then() NullPointerException
body: <p>productsInDatabse is a hashMap, output is enum, scanCode is from class which is tested</p>
  
  <pre><code>   public static boolean isInDataBase(int code) {
          return productsInDatabse.containsKey(code);
      }
  </code></pre>
  
  <p>and I've got a test:</p>
  
  <pre><code>@Test
  public void testScanCodeForCodeNotFound() {
  
      Database db = Mockito.mock(Database.class);
      when(db.isInDataBase(444)).thenReturn(false);
      output = scanner.scanCode("444");
      assertTrue(output == ProductProcessing.PRODUCT_NOT_FOUND);
  
  }
  </code></pre>
  
  <p>But when()...then() returns with NPE. I saw examples when invoking was exactly like this. So my question is where is the bug, because I thought when()...then() works likes that.</p>
  
  <p>Stacktrace:</p>
  
  <pre><code>Testcase: testScanCodeForCodeNotFound(iodevices.BarCodesScannerTest):   Caused an ERROR
  null
  java.lang.NullPointerException
      at database.Database.isInDataBase(Database.java:66)
      at iodevices.BarCodesScannerTest.testScanCodeForCodeNotFound(BarCodesScannerTest.java:50)
      at org.mockito.internal.runners.JUnit45AndHigherRunnerImpl.run(JUnit45AndHigherRunnerImpl.java:37)
      at org.mockito.runners.MockitoJUnitRunner.run(MockitoJUnitRunner.java:62)
  
  
  Test iodevices.BarCodesScannerTest FAILED
  </code></pre>