title: Mockito verify unit test - Wanted but not invoked. Actually, there were zero interactions with this mock
body: <p>At first I want to sorry for my english.</p>
  
  <p>I started to make some unit tests (i've never done this before, i'm a new guy in programming). </p>
  
  <p>I have to test simple adding product to database (DynamoDB) method using mockito.verify but I have </p>
  
  <pre><code>"Wanted but not invoked. Actually, there were zero interactions with this mock." 
  </code></pre>
  
  <p>Error and I don't know what to do.</p>
  
  <p>This is my method code (in KitchenService class): </p>
  
  <pre><code>public Product addProduct(Product content) {
  
      ObjectMapper objectMapper = new ObjectMapper();
  
      String mediaJSON = null;
      String authorJSON = null;
      String productKindsJSON = null;
      try {
          mediaJSON = objectMapper.writeValueAsString(content.getMedia());
          authorJSON = objectMapper.writeValueAsString(content.getAuthor());
          productKindsJSON = objectMapper.writeValueAsString(content.getProductKinds());
      } catch (JsonProcessingException e) {
          logger.log(e.getMessage());
      }
  
  
      Item item = new Item()
              .withPrimaryKey("id", UUID.randomUUID().toString())
              .with("name", content.getName())
              .with("calories", content.getCalories())
              .with("fat", content.getFat())
              .with("carbo", content.getCarbo())
              .with("protein", content.getProtein())
              .with("productKinds", productKindsJSON)
              .with("author", authorJSON)
              .with("media", mediaJSON)
              .with("approved", content.getApproved());
  
  
      Item save = databaseController.saveProduct(PRODUCT_TABLE, item);
      logger.log(save + " created");
  
  
  
      return content;
  
  }
  </code></pre>
  
  <p>And this is test code:</p>
  
  <pre><code>@Test
  public void addProduct() throws Exception {
  
  
      KitchenService instance = mock(KitchenService.class);
  
  
      Product expectedProduct = new Product();
      expectedProduct.setName("kaszanka");
      expectedProduct.setCalories(1000);
      expectedProduct.setFat(40.00);
      expectedProduct.setCarbo(20.00);
      expectedProduct.setProtein(40.00);
      expectedProduct.setProductKinds(Collections.singletonList(ProductKind.MEAT));
      expectedProduct.setApproved(false);
      Author expectedAuthor = new Author();
      expectedAuthor.setId("testID");
      expectedAuthor.setName("Endrju Golota");
      expectedProduct.setAuthor(expectedAuthor);
      Media expectedMedia = new Media();
      expectedMedia.setMediaType(MediaType.IMAGE);
      expectedMedia.setName("dupajasia");
      expectedMedia.setUrl("http://blabla.pl");
      expectedProduct.setMedia(expectedMedia);
  
      verify(instance, times(1)).addProduct(expectedProduct);
  }
  </code></pre>
  
  <p>This is what I got after test:</p>
  
  <pre><code>Wanted but not invoked:
  kitchenService.addProduct(
      model.kitchen.Product@a0136253
  );
  -&gt; at     service.kitchen.KitchenServiceTest.addProduct(KitchenServiceTest.java:80)
  Actually, there were zero interactions with this mock.
  </code></pre>
  
  <p>Can someone tell me what im doing wrong?</p>