use of com.faforever.client.task.TaskService in project downlords-faf-client by FAForever.
the class ReplayVaultControllerTest method testLoadLocalReplaysInBackground.
@Test
public void testLoadLocalReplaysInBackground() throws Exception {
LoadLocalReplaysTask task = mock(LoadLocalReplaysTask.class);
when(task.getFuture()).thenReturn(CompletableFuture.completedFuture(Arrays.asList(ReplayInfoBeanBuilder.create().get(), ReplayInfoBeanBuilder.create().get(), ReplayInfoBeanBuilder.create().get())));
when(applicationContext.getBean(LoadLocalReplaysTask.class)).thenReturn(task);
CountDownLatch loadedLatch = new CountDownLatch(1);
((TableView) instance.getRoot()).getItems().addListener((InvalidationListener) observable -> loadedLatch.countDown());
instance.loadLocalReplaysInBackground();
assertTrue(loadedLatch.await(5000, TimeUnit.MILLISECONDS));
assertThat(((TableView) instance.getRoot()).getItems().size(), is(3));
verify(taskService).submitTask(task);
verifyZeroInteractions(notificationService);
}
Aggregations