title: Mockito Unit tests - Timestamps are different
body: <p>Having some issues with a Mockito test.</p>
  
  <p>I  currently get this error:</p>
  
  <pre><code>Argument(s) are different! Wanted:
  repository.save(
      uk.co.withersoft.docservice.repositories.hibernate.MetaDataEntity@3e437e6c
  );
  -&gt; at uk.co.withersoft.docservice.datastore.impl.MetaDataStoreImplTest.storeClaimMetadata(MetaDataStoreImplTest.java:55)
  Actual invocation has different arguments:
  repository.save(
      uk.co.withersoft.docservice.repositories.hibernate.MetaDataEntity@3e361ee2
  );
  </code></pre>
  
  <p>I'm pretty sure its because the times within <code>MetaDataEntity</code> are different</p>
  
  <p>//This is what I should be getting</p>
  
  <pre><code>id = null
  metaData = "{"caseReference":"CN00000001","claimReference":"LN00000001","rpsDocumentType":"REJ","documentTitle":"Claims LN00000001 (Claimant: Mr LOCAL HOST) REJ-Rejection letter"}"
  batchId = 0
  state = "Saved MetaData to DB"
  lastUpdatedDate = {Timestamp@1517} "2018-07-25 18:39:21.993"
  createdDate = {Timestamp@1518} "2018-07-25 18:39:21.993"
  </code></pre>
  
  <p>// This is actually what I get. </p>
  
  <pre><code>id = null
  metaData = "{"caseReference":"CN00000001","claimReference":"LN00000001","rpsDocumentType":"REJ","documentTitle":"Claims LN00000001 (Claimant: Mr LOCAL HOST) REJ-Rejection letter"}"
  batchId = 0
  state = "Saved MetaData to DB"
  lastUpdatedDate = {Timestamp@1530} "2018-07-25 18:39:49.274"
  createdDate = {Timestamp@1531} "2018-07-25 18:39:52.716"
  </code></pre>
  
  <p>Here is my test case:</p>
  
  <pre><code>@Test
      public void storeClaimMetadata () throws JsonProcessingException {
  
          ClaimMetaData metaData = constructMetaData();
  
          MetaDataEntity mockResponseMetaDataEntity = new MetaDataEntity();
          mockResponseMetaDataEntity.setId(1);
  
          when(repository.save(any(MetaDataEntity.class))).thenReturn(mockResponseMetaDataEntity);
  
          Integer result = testSubject.storeClaimMetadata(metaData);
  
          assertEquals(Integer.valueOf(1), result);
  
          final ObjectMapper mapper = new ObjectMapper();
          String jsonMetaData = mapper.writeValueAsString(metaData);
  
          MetaDataEntity expectedMetaDataEntity = new MetaDataEntity(null,
                                                                     jsonMetaData,
                                                                     0,
                                                                     "Saved MetaData to DB",
                                                                     new Timestamp(System.currentTimeMillis()),
                                                                     new Timestamp(System.currentTimeMillis()));
  
          Mockito.verify(repository, times(1)).save(expectedMetaDataEntity);
      }
  
      //Creates a ClaimRequest
      private ClaimMetaData constructMetaData() {
          final ClaimMetaData metaData  = new ClaimMetaData("CN00000001",
                                                            "LN00000001",
                                                            "REJ",
                                                            "Claims LN00000001 (Claimant: Mr LOCAL HOST) REJ-Rejection letter");
  
          return metaData;
      }
  </code></pre>
  
  <p>Any help would be much appreciated. This has been driving me crazy!!</p>