ActionCreator { public final void createEditTodoAction(long todoId, String newDescription) { DataBundle<TodoAction.DataKeys> bundle = new DataBundle<>(); bundle.put(TodoAction.DataKeys.ID, todoId); bundle.put(TodoAction.DataKeys.DESCRIPTION, newDescription); actionBus.post(new TodoAction(TodoAction.ActionTypes.EDIT, bundle)); } @Inject  ActionCreator(ActionBus actionBus); final void createNewTodoAction(final String newTodoDescription); final void createToggleTodoCompleteAction(long todoId); final void createToggleAllTodosCompleteAction(); final void createEditTodoAction(long todoId, String newDescription); final void createDeleteTodoAction(long todoId); final void createDeleteAllCompleteTodosAction(); final void createUndoDeleteAllCompleteTodosAction(); final void createViewAllTodosAction(); final void createViewActiveTodosAction(); final void createViewCompleteTodosAction(); final void createSetTodoItemAsEditableAction(long todoId);  }
@Test public void createEditTodoActionTest() { final AtomicBoolean testDone = new AtomicBoolean(false); actionBus.register(new Object() { @Subscribe public void addTodo(TodoAction action) { assertThat(action.getData().get(TodoAction.DataKeys.ID, -1)).isEqualTo(10); assertThat(action.getData().get(TodoAction.DataKeys.DESCRIPTION, "")).isEqualTo("New Description"); testDone.set(true); } }); actionCreator.createEditTodoAction(10, "New Description"); while (!testDone.get()) ; }