@Test public void testDeleteNotExisting() { final String intygId = "intygId"; final String questionId = "questionId"; when(repo.findByIntygIdAndQuestionId(intygId, questionId)).thenReturn(null); boolean res = arendeDraftService.delete(intygId, questionId); assertFalse(res); verify(repo).findByIntygIdAndQuestionId(intygId, questionId); verifyNoMoreInteractions(repo); }
@Override public boolean delete(String intygId, String questionId) { ArendeDraft draft = arendeDraftRepository.findByIntygIdAndQuestionId(intygId, questionId); if (draft != null) { arendeDraftRepository.delete(draft); return true; } else { return false; } }
ArendeDraftServiceImpl implements ArendeDraftService { @Override public boolean delete(String intygId, String questionId) { ArendeDraft draft = arendeDraftRepository.findByIntygIdAndQuestionId(intygId, questionId); if (draft != null) { arendeDraftRepository.delete(draft); return true; } else { return false; } } }
ArendeDraftServiceImpl implements ArendeDraftService { @Override public boolean delete(String intygId, String questionId) { ArendeDraft draft = arendeDraftRepository.findByIntygIdAndQuestionId(intygId, questionId); if (draft != null) { arendeDraftRepository.delete(draft); return true; } else { return false; } }  }
ArendeDraftServiceImpl implements ArendeDraftService { @Override public boolean delete(String intygId, String questionId) { ArendeDraft draft = arendeDraftRepository.findByIntygIdAndQuestionId(intygId, questionId); if (draft != null) { arendeDraftRepository.delete(draft); return true; } else { return false; } }  @Override boolean saveDraft(String intygId, String questionId, String text, String amne); @Override boolean delete(String intygId, String questionId); @Override List<ArendeDraft> listAnswerDrafts(String intygId); @Override ArendeDraft getQuestionDraft(String intygId); }
ArendeDraftServiceImpl implements ArendeDraftService { @Override public boolean delete(String intygId, String questionId) { ArendeDraft draft = arendeDraftRepository.findByIntygIdAndQuestionId(intygId, questionId); if (draft != null) { arendeDraftRepository.delete(draft); return true; } else { return false; } }  @Override boolean saveDraft(String intygId, String questionId, String text, String amne); @Override boolean delete(String intygId, String questionId); @Override List<ArendeDraft> listAnswerDrafts(String intygId); @Override ArendeDraft getQuestionDraft(String intygId);  }