ActiveResource implements CommonRestResource, SingletonRestResource { @GET @Produces("application/json") @Path("/jobs") public void activeJobs(@Suspended AsyncResponse asyncResponse) { try { ReactiveSeq.of(this.activeJobs) .map(JobsBeingExecuted::toString) .foldFuture(WorkerThreads.ioExecutor.get(), s -> s.forEach(Long.MAX_VALUE, str -> asyncResponse.resume(str))); } catch (Exception e) { e.printStackTrace(); } } @Autowired  ActiveResource(RequestTypes<T> activeQueries, JobsBeingExecuted activeJobs); @GET @Produces("application/json") @Path("/requests") void activeRequests(@Suspended AsyncResponse asyncResponse, @QueryParam("type") final String type); @GET @Produces("application/json") @Path("/all-requests") void allActiveRequests(@Suspended AsyncResponse asyncResponse); @GET @Produces("application/json") @Path("/jobs") void activeJobs(@Suspended AsyncResponse asyncResponse);  }
@Test public void testActiveJobs() throws Throwable { ProceedingJoinPoint pjp = mock(ProceedingJoinPoint.class); Signature signature = mock(Signature.class); when(pjp.getSignature()).thenReturn(signature); when(pjp.getTarget()).thenReturn(this); when(signature.getDeclaringType()).thenReturn(ScheduledJob.class); jobs.aroundScheduledJob(pjp); MockAsyncResponse<String> response = new MockAsyncResponse<>(); active.activeJobs(response); assertThat(convert(response.response()).get("events"), is(1)); }