title: Unit test GeneratedKeyHolder in namedParameterJdbcTemplate
body: <p>I am trying to write a unit test to a function that holds the following code:</p>
  
  <blockquote>
  <pre><code>    KeyHolder newCode = new GeneratedKeyHolder();
      try {
          namedParameterJdbcTemplate.update(sql, paramMap, newCode);
      } catch (DuplicateKeyException e) {
          logger.error("Duplicate Key");
      }
      data.setId(newCode.getKey().intValue());
  </code></pre>
  </blockquote>
  
  <p>right now, while using Mockito:</p>
  
  <pre><code>Mockito.when(namedParameterJdbcTemplate.update(Mockito.anyString(), Mockito.any(MapSqlParameterSource.class), Mockito.any(GeneratedKeyHolder.class))).thenReturn(1);
  </code></pre>
  
  <p>So how am i supposed to fill the <code>GeneratedKeyHolder</code> with Data?</p>
  
  <p>Thanks.</p>