TaskServiceImpl implements TaskService { @Override public Task getById(Integer id) { return tasks.get(id); } TaskServiceImpl(); @Override Task getById(Integer id); @Override void addOrUpdate(Task task); @Override Collection<Task> getAll(); @Override void delete(Integer id);  }
@Test public void testGet() { Task task = taskService.getById(1); assertThat(task.getTitle(), equalTo("Buy some Coffee")); }
@Test public void testNotFound() { Task task = taskService.getById(3); assertThat(task, nullValue()); }