### Question:
SourceDocumentProcessingStatisticsDaoImpl implements SourceDocumentProcessingStatisticsDao { @Override public boolean update(SourceDocumentProcessingStatistics sourceDocumentProcessingStatistics, WriteConcern writeConcern) { if (read(sourceDocumentProcessingStatistics.getId()) != null) { datastore.save(sourceDocumentProcessingStatistics, writeConcern); return true; } return false; } SourceDocumentProcessingStatisticsDaoImpl(Datastore datastore); @Override Long getCount(); @Override boolean create(SourceDocumentProcessingStatistics sourceDocumentProcessingStatistics, WriteConcern writeConcern); @Override SourceDocumentProcessingStatistics read(String id); @Override List<SourceDocumentProcessingStatistics> read(List<String> ids); @Override boolean update(SourceDocumentProcessingStatistics sourceDocumentProcessingStatistics, WriteConcern writeConcern); @Override com.google.code.morphia.Key<SourceDocumentProcessingStatistics> createOrModify(SourceDocumentProcessingStatistics sourceDocumentProcessingStatistics, WriteConcern writeConcern); @Override Iterable<com.google.code.morphia.Key<SourceDocumentProcessingStatistics>> createOrModify(Collection<SourceDocumentProcessingStatistics> sourceDocumentProcessingStatistics,
                                                                                                    WriteConcern writeConcern); @Override WriteResult delete(String id); @Override SourceDocumentProcessingStatistics findBySourceDocumentReferenceAndJobId(String docId, String jobId); @Override List<SourceDocumentProcessingStatistics> findByRecordID(String recordID); @Override Map<ProcessingState, Long> countNumberOfDocumentsWithState(); @Override List<SourceDocumentProcessingStatistics> deactivateDocuments(List<String> sourceDocumentReferenceIds, WriteConcern writeConcern); @Override List<SourceDocumentProcessingStatistics> findByExecutionIdAndState(String executionId, List<ProcessingState> states);  }### Answer:
@Test public void testUpdate() throws Exception { final SourceDocumentProcessingStatistics sourceDocumentProcessingStatistics = new SourceDocumentProcessingStatistics(new Date(), new Date(), true, null, ProcessingState.DOWNLOADING, new ReferenceOwner("1", "1", "1"), null, "", "", 100, "", 150*1024l, 50l, 0l, 0l, "", null, "",null); assertFalse(sourceDocumentProcessingStatisticsDao.update(sourceDocumentProcessingStatistics, WriteConcern.NONE)); sourceDocumentProcessingStatisticsDao.create(sourceDocumentProcessingStatistics, WriteConcern.NONE); final SourceDocumentProcessingStatistics updatedSourceDocumentProcessingStatistics = new SourceDocumentProcessingStatistics(sourceDocumentProcessingStatistics.getId(), sourceDocumentProcessingStatistics.getCreatedAt(), sourceDocumentProcessingStatistics.getUpdatedAt(), true, null, ProcessingState.SUCCESS, sourceDocumentProcessingStatistics.getReferenceOwner(), null, sourceDocumentProcessingStatistics.getSourceDocumentReferenceId(), sourceDocumentProcessingStatistics.getProcessingJobId(), sourceDocumentProcessingStatistics.getHttpResponseCode(), sourceDocumentProcessingStatistics.getHttpResponseContentType(), sourceDocumentProcessingStatistics.getHttpResponseContentSizeInBytes(), sourceDocumentProcessingStatistics.getRetrievalDurationInMilliSecs(), sourceDocumentProcessingStatistics.getSocketConnectToDownloadStartDurationInMilliSecs(), sourceDocumentProcessingStatistics.getCheckingDurationInMilliSecs(), sourceDocumentProcessingStatistics.getSourceIp(), sourceDocumentProcessingStatistics.getHttpResponseHeaders(), "",null); assertTrue(sourceDocumentProcessingStatisticsDao.update(updatedSourceDocumentProcessingStatistics, WriteConcern.NONE)); assertEquals(sourceDocumentProcessingStatisticsDao.read(sourceDocumentProcessingStatistics.getId()).getState(), ProcessingState.SUCCESS); sourceDocumentProcessingStatisticsDao.delete(updatedSourceDocumentProcessingStatistics.getId()); }