BackgroundRepository implements Repository { @Override public RepositoryDTO fetchInstallableApplications() { throw new UnsupportedOperationException("The background apps manager is asynchronous"); } BackgroundRepository(Repository delegatedRepository, ExecutorService executorService); @Override RepositoryDTO fetchInstallableApplications(); @Override void onDelete(); @Override void fetchInstallableApplications(Consumer<RepositoryDTO> callback, Consumer<Exception> errorCallback); @Override void getScript(List<String> path, Consumer<ScriptDTO> callback, Consumer<Exception> errorCallback); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testFetchInstallableApplicationsTaskIsPassed() { doAnswer(invocation -> { ((Runnable) invocation.getArguments()[0]).run(); return null; }).when(mockExecutor).submit(any(Runnable.class)); when(mockRepository.fetchInstallableApplications()).thenReturn(mockResults); backgroundRepository.fetchInstallableApplications(categoryDTOs -> { }, e -> { }); verify(mockRepository).fetchInstallableApplications(any(), any()); }