### Question:
ResourceSetResource implements CollectionResourceProvider { @Override public Promise<QueryResponse, ResourceException> queryCollection(final Context context, final QueryRequest request, final QueryResourceHandler handler) { final String userId = getUserId(context); final ResourceSetWithPolicyQuery query; try { if (request.getQueryId() != null && request.getQueryId().equals("*")) { query = new ResourceSetWithPolicyQuery(); query.setResourceSetQuery(QueryFilter.<String>alwaysTrue()); } else if (request.getQueryFilter() != null) { query = beforeQueryResourceSets(userId, request) .accept(new ResourceSetQueryFilter(context), new ResourceSetWithPolicyQuery()); } else { return new BadRequestException("Invalid query").asPromise(); } } catch (UnsupportedOperationException e) { return new NotSupportedException(e.getMessage()).asPromise(); } boolean augmentWithPolicies = augmentWithPolicies(request); String realm = getRealm(context); return resourceSetService.getResourceSets(context, realm, query, userId, augmentWithPolicies) .thenAsync(new AsyncFunction<Collection<ResourceSetDescription>, QueryResponse, ResourceException>() { @Override public Promise<QueryResponse, ResourceException> apply(Collection<ResourceSetDescription> resourceSets) { try { List<ResourceResponse> resources = new ArrayList<>(); for (ResourceSetDescription resourceSet : resourceSets) { resources.add(newResource(resourceSet.getId(), getResourceSetJson(resourceSet, userId))); } QueryResponsePresentation.enableDeprecatedRemainingQueryResponse(request); return QueryResponsePresentation.perform(handler, request, resources); } catch (ResourceException e) { return e.asPromise(); } } }); } @Inject  ResourceSetResource(ResourceSetService resourceSetService, ContextHelper contextHelper,
            UmaLabelsStore umaLabelsStore, ResourceSetDescriptionValidator validator,
            ExtensionFilterManager extensionFilterManager); @Override Promise<ResourceResponse, ResourceException> createInstance(Context context, CreateRequest request); @Override Promise<ResourceResponse, ResourceException> readInstance(Context context, String resourceId,
            ReadRequest request); @Override Promise<ActionResponse, ResourceException> actionCollection(Context context, ActionRequest request); @Override Promise<QueryResponse, ResourceException> queryCollection(final Context context, final QueryRequest request,
            final QueryResourceHandler handler); @Override Promise<ResourceResponse, ResourceException> updateInstance(Context context, String resourceId,
            UpdateRequest request); @Override Promise<ResourceResponse, ResourceException> deleteInstance(Context context, String resourceId,
            DeleteRequest request); @Override Promise<ResourceResponse, ResourceException> patchInstance(Context context, String resourceId,
            PatchRequest request); @Override Promise<ActionResponse, ResourceException> actionInstance(Context context, String resourceId,
            ActionRequest request);  }### Answer:
@Test public void queryShouldNotBeSupported() { Context context = mock(Context.class); QueryRequest request = mock(QueryRequest.class); QueryResourceHandler handler = mock(QueryResourceHandler.class); given(request.getQueryFilter()).willReturn(QueryFilter.equalTo(new JsonPointer("/fred"), 5)); Promise<QueryResponse, ResourceException> promise = resource.queryCollection(context, request, handler); AssertJPromiseAssert.assertThat(promise).failedWithException().isInstanceOf(NotSupportedException.class); }
@Test public void queryShouldNotBeSupported() { Context context = mock(Context.class); QueryRequest request = mock(QueryRequest.class); QueryResourceHandler handler = mock(QueryResourceHandler.class); given(request.getQueryFilter()).willReturn(QueryFilter.equalTo(new JsonPointer("/fred"), 5)); Promise<QueryResponse, ResourceException> promise = resource.queryCollection(context, request, handler); assertThat(promise).failedWithException().isInstanceOf(NotSupportedException.class); }