GetMenuItemsUseCase extends UseCase<List<ItemMenu>> { @Override public Observable<List<ItemMenu>> react() { ItemMenu users = new ItemMenu(ID_USERS); dashboardItemsMenu.configureUsers(users); ItemMenu user = new ItemMenu(ID_USER); dashboardItemsMenu.configureUser(user); ItemMenu searchUser = new ItemMenu(ID_SEARCH_USER); dashboardItemsMenu.configureSearchUser(searchUser); return Observable.just(Arrays.asList(users, user, searchUser)); } @Inject  GetMenuItemsUseCase(DashboardItemsMenu dashboardItemsMenu, UI ui); @Override Observable<List<ItemMenu>> react(); static final int ID_USERS; }
@Test public void When_Execute_Get_Items_Menu() { TestSubscriber<List<ItemMenu>> subscriberMock = new TestSubscriber<>(); getMenuItemsUseCase.react().subscribe(subscriberMock); subscriberMock.awaitTerminalEvent(); assertThat(subscriberMock.getOnCompletedEvents().size(), is(1)); }