### Question:
UmaLabelResource implements CollectionResourceProvider { @Override public Promise<QueryResponse, ResourceException> queryCollection(Context serverContext, QueryRequest queryRequest, QueryResourceHandler queryResultHandler) { if (!queryRequest.getQueryFilter().toString().equals("true")) { return new BadRequestException("Invalid query").asPromise(); } Set<ResourceSetLabel> labels; try { labels = labelStore.list(getRealm(serverContext), getUserName(serverContext)); } catch (ResourceException e) { return new BadRequestException("Error retrieving labels.").asPromise(); } LocaleContext localeContext = localeContextProvider.get(); localeContext.setLocale(serverContext); for (ResourceSetLabel label : labels) { try { label = resolveLabelName(contextHelper.getRealm(serverContext), label, localeContext, serverContext); } catch (InternalServerErrorException e) { debug.error("Could not resolve Resource Server label name. id: {}, name: {}", label.getId(), label.getName(), e); } queryResultHandler.handleResource(newResourceResponse(label.getId(), String.valueOf(label.asJson().getObject().hashCode()), label.asJson())); } return newResultPromise(newQueryResponse()); } @Inject  UmaLabelResource(UmaLabelsStore labelStore, ContextHelper contextHelper,
            ClientRegistrationStore clientRegistrationStore, Provider<LocaleContext> localeContextProvider); @Override Promise<ActionResponse, ResourceException> actionCollection(Context serverContext,
            ActionRequest actionRequest); @Override Promise<ActionResponse, ResourceException> actionInstance(Context serverContext, String s,
            ActionRequest actionRequest); @Override Promise<ResourceResponse, ResourceException> createInstance(Context serverContext,
            CreateRequest createRequest); @Override Promise<ResourceResponse, ResourceException> deleteInstance(Context serverContext, String labelId,
            DeleteRequest deleteRequest); @Override Promise<ResourceResponse, ResourceException> patchInstance(Context serverContext, String s,
            PatchRequest patchRequest); @Override Promise<QueryResponse, ResourceException> queryCollection(Context serverContext,
            QueryRequest queryRequest, QueryResourceHandler queryResultHandler); @Override Promise<ResourceResponse, ResourceException> readInstance(Context serverContext, String s,
            ReadRequest readRequest); @Override Promise<ResourceResponse, ResourceException> updateInstance(Context serverContext, String s,
            UpdateRequest updateRequest);  }### Answer:
@Test public void queryLabelsFails() throws ResourceException { given(umaLabelsStore.list(REALM_NAME, RESOURCE_OWNER_ID)).willReturn(Collections.<ResourceSetLabel>emptySet()); given(queryRequest.getQueryFilter()).willReturn(QueryFilter.<JsonPointer>alwaysFalse()); Promise<QueryResponse, ResourceException> promise = umaLabelResource.queryCollection(serverContext, queryRequest, queryResourceHandler); verifyZeroInteractions(umaLabelsStore); assertThat(promise).failedWithException().isInstanceOf(BadRequestException.class); }