### Question:
ResourceSetResource implements CollectionResourceProvider { @Override public Promise<ActionResponse, ResourceException> actionCollection(Context context, ActionRequest request) { if ("revokeAll".equalsIgnoreCase(request.getAction())) { String realm = getRealm(context); String resourceOwnerId = getUserId(context); return resourceSetService.revokeAllPolicies(context, realm, resourceOwnerId) .thenAsync(new AsyncFunction<Void, ActionResponse, ResourceException>() { @Override public Promise<ActionResponse, ResourceException> apply(Void value) throws ResourceException { return newResultPromise(newActionResponse(json(object()))); } }); } else { return new NotSupportedException("Action " + request.getAction() + " not supported").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 actionCollectionShouldNotBeSupported() { Context context = mock(Context.class); ActionRequest request = mock(ActionRequest.class); Promise<ActionResponse, ResourceException> promise = resource.actionCollection(context, request); AssertJPromiseAssert.assertThat(promise).failedWithException().isInstanceOf(NotSupportedException.class); }
@Test public void actionCollectionShouldHandleUnsupportedAction() { Context context = mock(Context.class); ActionRequest request = mock(ActionRequest.class); given(request.getAction()).willReturn("UNSUPPORTED_ACTION"); Promise<ActionResponse, ResourceException> promise = resource.actionCollection(context, request); AssertJPromiseAssert.assertThat(promise).failedWithException().isInstanceOf(NotSupportedException.class); }
@Test public void actionCollectionShouldNotBeSupported() { Context context = mock(Context.class); ActionRequest request = mock(ActionRequest.class); Promise<ActionResponse, ResourceException> promise = resource.actionCollection(context, request); assertThat(promise).failedWithException().isInstanceOf(NotSupportedException.class); }
@Test public void actionCollectionShouldHandleUnsupportedAction() { Context context = mock(Context.class); ActionRequest request = mock(ActionRequest.class); given(request.getAction()).willReturn("UNSUPPORTED_ACTION"); Promise<ActionResponse, ResourceException> promise = resource.actionCollection(context, request); assertThat(promise).failedWithException().isInstanceOf(NotSupportedException.class); }