ActionCreator { public final void createViewCompleteTodosAction() { actionBus.post(new ViewAction(ViewAction.ActionTypes.VIEW_COMPLETE)); } @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 createViewCompleteTodosActionTest() { final AtomicBoolean testDone = new AtomicBoolean(false); actionBus.register(new Object() { @Subscribe public void addTodo(ViewAction action) { assertThat(action.getType()).isEqualTo(ViewAction.ActionTypes.VIEW_COMPLETE); testDone.set(true); } }); actionCreator.createViewCompleteTodosAction(); while (!testDone.get()) ; }