### Question:
ApplicationV1Filter implements Filter { @Override public Promise<QueryResponse, ResourceException> filterQuery(final Context context, final QueryRequest request, final QueryResourceHandler handler, final RequestHandler next) { final List<ResourceResponse> resources = new ArrayList<>(); return applicationTransformer.transform(next.handleQuery(context, request, new QueryResourceHandler() { @Override public boolean handleResource(ResourceResponse resource) { return resources.add(resource); } }), context, request, handler, resources); } @Inject  ApplicationV1Filter(final ResourceTypeService resourceTypeService,
                               final ApplicationServiceFactory applicationServiceFactory,
                               final ExceptionMappingHandler<EntitlementException, ResourceException> resourceErrorHandler,
                               final ContextHelper contextHelper,
                               final ApplicationV1FilterTransformer applicationTransformer,
                               @Named("frRest") final Debug debug); @Override Promise<ResourceResponse, ResourceException> filterCreate(final Context context,
            final CreateRequest request, final RequestHandler next); @Override Promise<ResourceResponse, ResourceException> filterUpdate(final Context context,
            final UpdateRequest request, final RequestHandler next); @Override Promise<ResourceResponse, ResourceException> filterDelete(Context context, DeleteRequest request,
            RequestHandler next); @Override Promise<QueryResponse, ResourceException> filterQuery(final Context context,
            final QueryRequest request, final QueryResourceHandler handler, final RequestHandler next); @Override Promise<ResourceResponse, ResourceException> filterRead(final Context context,
            final ReadRequest request, final RequestHandler next); @Override Promise<ResourceResponse, ResourceException> filterPatch(Context context, PatchRequest request,
            RequestHandler next); @Override Promise<ActionResponse, ResourceException> filterAction(Context context, ActionRequest request,
            RequestHandler next); static final String RESOURCE_TYPE_UUIDS; static final String ACTIONS; static final String RESOURCES; static final String APPLICATION_NAME; static final String REALM; }### Answer:
@Test public void forwardOnQuery() throws Exception { given(contextHelper.getRealm(context)).willReturn("/abc"); given(contextHelper.getSubject(context)).willReturn(subject); QueryRequest queryRequest = mock(QueryRequest.class); given(requestHandler.handleQuery(eq(context), eq(queryRequest), any(QueryResourceHandler.class))) .willReturn(mockQueryResponse); filter.filterQuery(context, queryRequest, queryResultHandler, requestHandler); verify(requestHandler).handleQuery(eq(context), eq(queryRequest), queryResultHandlerCaptor.capture()); verify(applicationTransformer).transform(eq(mockQueryResponse), eq(context), eq(queryRequest), eq(queryResultHandler), anyCollectionOf(ResourceResponse.class)); }