@Test(expected = IllegalArgumentException.class) public void testAddIllegal() { Task task = new Task(); taskService.addOrUpdate(task); }
@Override public void addOrUpdate(Task task) { if (task.getId() == null) { throw new IllegalArgumentException("Id property must be set"); } tasks.put(task.getId(), task); }
TaskServiceImpl implements TaskService { @Override public void addOrUpdate(Task task) { if (task.getId() == null) { throw new IllegalArgumentException("Id property must be set"); } tasks.put(task.getId(), task); } }
TaskServiceImpl implements TaskService { @Override public void addOrUpdate(Task task) { if (task.getId() == null) { throw new IllegalArgumentException("Id property must be set"); } tasks.put(task.getId(), task); } TaskServiceImpl(); }
TaskServiceImpl implements TaskService { @Override public void addOrUpdate(Task task) { if (task.getId() == null) { throw new IllegalArgumentException("Id property must be set"); } tasks.put(task.getId(), task); } TaskServiceImpl(); @Override Task getById(Integer id); @Override void addOrUpdate(Task task); @Override Collection<Task> getAll(); @Override void delete(Integer id); }
TaskServiceImpl implements TaskService { @Override public void addOrUpdate(Task task) { if (task.getId() == null) { throw new IllegalArgumentException("Id property must be set"); } tasks.put(task.getId(), task); } TaskServiceImpl(); @Override Task getById(Integer id); @Override void addOrUpdate(Task task); @Override Collection<Task> getAll(); @Override void delete(Integer id);  }