### Question:
UmaLabelResource implements CollectionResourceProvider { @Override public Promise<ResourceResponse, ResourceException> createInstance(Context serverContext, CreateRequest createRequest) { final JsonValue umaLabel = createRequest.getContent(); try { validate(umaLabel); } catch (BadRequestException e) { return e.asPromise(); } final String realm = getRealm(serverContext); final String userName = getUserName(serverContext); final String labelName = umaLabel.get(NAME_LABEL).asString(); final String labelType = umaLabel.get(TYPE_LABEL).asString(); final ResourceSetLabel label; try { label = labelStore.create(realm, userName, new ResourceSetLabel(null, labelName, LabelType.valueOf(labelType), Collections.EMPTY_SET)); return newResultPromise(newResourceResponse(label.getId(), String.valueOf(label.hashCode()), label.asJson())); } catch (ResourceException e) { return e.asPromise(); } } @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 createInstance() throws ResourceException { JsonValue umaLabel = json(object( field(NAME_ATTRIBUTE_NAME, LABEL_NAME), field(TYPE_ATTRIBUTE_NAME, LABEL_TYPE) )); given(createRequest.getContent()).willReturn(umaLabel); given(contextHelper.getRealm(serverContext)).willReturn(REALM_NAME); given(contextHelper.getUserId(serverContext)).willReturn(RESOURCE_OWNER_ID); final ResourceSetLabel resourceSetLabel = new ResourceSetLabel(null, LABEL_NAME, LabelType.valueOf(LABEL_TYPE), Collections.EMPTY_SET); given(umaLabelsStore.create(REALM_NAME, RESOURCE_OWNER_ID, resourceSetLabel)).willReturn(resourceSetLabel); Promise<ResourceResponse, ResourceException> promise = umaLabelResource.createInstance(serverContext, createRequest); verify(umaLabelsStore, Mockito.times(1)).create(REALM_NAME, RESOURCE_OWNER_ID, resourceSetLabel); assertThat(promise).succeeded(); }