void () { final Ref<Boolean> stopper = new Ref<>(Boolean.FALSE); TestRepository repository = new TestRepository(new LocalTaskImpl("foo", "bar")) { @Override public Task[] getIssues(@Nullable String query, int max, long since) throws Exception { if (stopper.get()) throw new Exception(); return super.getIssues(query, max, since); } }; myTaskManager.setRepositories(Collections.singletonList(repository)); List<Task> issues = myTaskManager.getIssues(""); assertEquals(1, issues.size()); stopper.set(Boolean.TRUE); TaskSearchSupport.getRepositoriesTasks(getProject(), "", 0, 100, true, false, new EmptyProgressIndicator()); assertEquals(1, issues.size()); }