### Question:
FlowControlledRequestFilter implements ContainerRequestFilter { @Override public void filter(final ContainerRequestContext requestContext) throws IOException { final String path = requestContext.getUriInfo().getRequestUri().getPath(); final boolean isStatusResource = path.matches("/status(/.*)?"); if (!isStatusResource) { try { final long start = rateLimitLogging ? System.currentTimeMillis() : 0l; restRequestRateLimiter.takeToken(); if (rateLimitLogging) { logger.debug(path + " took " + ((System.currentTimeMillis() - start) / 1000) + "s to obtain a token to process"); } } catch (final InterruptedException e) { Thread.currentThread().interrupt(); } } } @Autowired  FlowControlledRequestFilter(final RateLimiter restRequestRateLimiter); @Override void filter(final ContainerRequestContext requestContext);  }### Answer:
@Test public void shouldApplyFlowControl_onNonStatusResourceRequest() throws Exception { setUpRequestPath("http: flowControlledRequestFilter.filter(mockContainerRequestContext); verify(mockRateLimiter).takeToken(); }
@Test public void shouldNotApplyFlowControl_onStatusResourceRequest() throws Exception { setUpRequestPath("http: flowControlledRequestFilter.filter(mockContainerRequestContext); verifyZeroInteractions(mockRateLimiter); }
@Test public void shouldNotApplyFlowControl_onStatusSubresourceRequest() throws Exception { setUpRequestPath("http: flowControlledRequestFilter.filter(mockContainerRequestContext); verifyZeroInteractions(mockRateLimiter); }