TodoListManager { public final void editTodo(long id, String description) { TodoItem oldItem = todoItems.get(id); todoItems.put(oldItem.getId(), new TodoItem(oldItem.getId(), description, oldItem.isComplete())); } @Inject  TodoListManager(ActionBus actionBus, DataBus dataBus); void onPause(); @Subscribe void reactToTodoAction(TodoAction action); @Produce RawTodoList produceTodoList(); final void addTodo(String description); final void toggleTodoComplete(long id); final void toggleAllTodosComplete(); final void editTodo(long id, String description); final void deleteTodo(long id); final void deleteAllCompleteTodos(); final void undoDeleteCompleteAllTodos();  }
@Test(timeout = 100) public void editTodoTest() throws InterruptedException { final AtomicBoolean testDone = new AtomicBoolean(false); final ArrayList<TodoItem> todoItems = new ArrayList<TodoItem>(); createTodos(1); dataBus.register(new Object() { @Subscribe public void onListUpdated(RawTodoList rawTodoList) { todoItems.clear(); todoItems.addAll(rawTodoList.list); if (todoItems.get(0).getDescription().equals("Testing 0")) { DataBundle<TodoAction.DataKeys> bundle = new DataBundle<>(); bundle.put(TodoAction.DataKeys.ID, todoItems.get(0).getId()); bundle.put(TodoAction.DataKeys.DESCRIPTION, "New Todo Description"); actionBus.post(new TodoAction(TodoAction.ActionTypes.EDIT, bundle)); } else { assertThat(todoItems.get(0).getDescription()).isEqualTo("New Todo Description"); testDone.set(true); } } }); while (!testDone.get()) ; }