@Test public void DeleteTest_When_GivenExistingTodoEntityId_ExpectTrue(){ TodoEntity alreadyExistingTodo = new TodoEntity(); alreadyExistingTodo.setId(1); alreadyExistingTodo.setStatus(TodoStatusType.OPEN); alreadyExistingTodo.setName("Test already existing name"); when(todoDAO.findById(alreadyExistingTodo.getId())).thenReturn(alreadyExistingTodo); assertThat(todoService.delete(alreadyExistingTodo.getId())).isTrue(); }
public boolean delete(long id) { if(todoDAO.findById(id) == null) return false; todoDAO.delete(id); return true; }
TodoService { public boolean delete(long id) { if(todoDAO.findById(id) == null) return false; todoDAO.delete(id); return true; } }
TodoService { public boolean delete(long id) { if(todoDAO.findById(id) == null) return false; todoDAO.delete(id); return true; }  }
TodoService { public boolean delete(long id) { if(todoDAO.findById(id) == null) return false; todoDAO.delete(id); return true; }  List<TodoEntity> getAll(); boolean add(TodoEntity entity); boolean edit(TodoEntity entity); boolean delete(long id); }
TodoService { public boolean delete(long id) { if(todoDAO.findById(id) == null) return false; todoDAO.delete(id); return true; }  List<TodoEntity> getAll(); boolean add(TodoEntity entity); boolean edit(TodoEntity entity); boolean delete(long id);  }