FeedCycleRenderer extends SwingWorker<Map<String, List<Map<String, String>>>, Map<String, List<Map<String, String>>>> { @Override protected void done() { if (isCancelled()) { LOGGER.debug("swing worker cancel detected in done method"); return; } renderFeeds(); PERF_LOGGER.debug( "feed cycle performance: data retrieval {0}, ui rendering {1}, total {2}", dataRequestTimer.getIntervalInMillis(), uiRenderingTimer .getIntervalInMillis(), dataRequestTimer .getIntervalInMillis() + uiRenderingTimer.getIntervalInMillis()); } FeedCycleRenderer(Map<FeedProvider, Long[]> timeMapping,
                    Set<FeedView> activeViews);   }
@SuppressWarnings("unchecked") @Test public void testDone() throws Exception { Map<FeedProvider, Long[]> times = new HashMap<FeedProvider, Long[]>(); FeedCycleRenderer worker = new FeedCycleRenderer(times, new HashSet<FeedView>(Arrays.asList(fv1, fv2, fv3))) { @Override Map<String, List<Map<String, String>>> getData() throws InterruptedException, ExecutionException { throw new RuntimeException(); } }; worker.done(); FeedView exManifestation = Mockito.mock(FeedView.class); Mockito.doThrow(new RuntimeException()).when(exManifestation).updateFromFeed(Mockito.anyMap()); FeedView goodManifestation = Mockito.mock(FeedView.class); worker = new FeedCycleRenderer(times, new HashSet<FeedView>(Arrays.asList(exManifestation, goodManifestation))) { @Override Map<String, List<Map<String, String>>> getData() throws InterruptedException, ExecutionException { return Collections.emptyMap(); } }; worker.done(); Mockito.verify(exManifestation).updateFromFeed(Mockito.anyMap()); Mockito.verify(goodManifestation).updateFromFeed(Mockito.anyMap()); }