@Test public void doRefreshTabsTest() throws InterruptedException { final CountDownLatch latch1 = mock(CountDownLatch.class); final TabPresenter<?> tab1 = mock(TabPresenter.class); when(tab1.refresh()).thenReturn(latch1); final CountDownLatch latch2 = mock(CountDownLatch.class); final TabPresenter<?> tab2 = mock(TabPresenter.class); when(tab2.refresh()).thenReturn(latch2); presenter.tabs.add(tab1); presenter.tabs.add(tab2); presenter.doRefreshTabs(); verify(tab1, only()).refresh(); verify(tab2, only()).refresh(); verify(latch1, only()).await(); verify(latch2, only()).await(); }
@VisibleForTesting @OnBackgroundThread void doRefreshTabs() { final ThrowingConsumer<CountDownLatch> await = CountDownLatch::await; tabs.stream().map(TabPresenter::refresh) .forEach(Throwing.consumer(await).orDoNothing()); }
TracePresenter extends BasePresenter<TraceView> { @VisibleForTesting @OnBackgroundThread void doRefreshTabs() { final ThrowingConsumer<CountDownLatch> await = CountDownLatch::await; tabs.stream().map(TabPresenter::refresh) .forEach(Throwing.consumer(await).orDoNothing()); } }
TracePresenter extends BasePresenter<TraceView> { @VisibleForTesting @OnBackgroundThread void doRefreshTabs() { final ThrowingConsumer<CountDownLatch> await = CountDownLatch::await; tabs.stream().map(TabPresenter::refresh) .forEach(Throwing.consumer(await).orDoNothing()); } TracePresenter(final MainWindowView mainView,
        final GuiTaskRunner taskRunner, final TraceDb traceDb); }
TracePresenter extends BasePresenter<TraceView> { @VisibleForTesting @OnBackgroundThread void doRefreshTabs() { final ThrowingConsumer<CountDownLatch> await = CountDownLatch::await; tabs.stream().map(TabPresenter::refresh) .forEach(Throwing.consumer(await).orDoNothing()); } TracePresenter(final MainWindowView mainView,
        final GuiTaskRunner taskRunner, final TraceDb traceDb); @Override void load(); void loadRulesTab(); @OnUiThread @VisibleForTesting RulesTabPresenter createRulesTabPresenter(); void loadTreeDepthTab(); void handleTabsRefreshEvent(); void close(); @Override @Nonnull String toString(); }
TracePresenter extends BasePresenter<TraceView> { @VisibleForTesting @OnBackgroundThread void doRefreshTabs() { final ThrowingConsumer<CountDownLatch> await = CountDownLatch::await; tabs.stream().map(TabPresenter::refresh) .forEach(Throwing.consumer(await).orDoNothing()); } TracePresenter(final MainWindowView mainView,
        final GuiTaskRunner taskRunner, final TraceDb traceDb); @Override void load(); void loadRulesTab(); @OnUiThread @VisibleForTesting RulesTabPresenter createRulesTabPresenter(); void loadTreeDepthTab(); void handleTabsRefreshEvent(); void close(); @Override @Nonnull String toString();  }