### Question:
ValidationResourceProvider extends StackAdvisorResourceProvider { @Override public RequestStatus createResources(final Request request) throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException { StackAdvisorRequest validationRequest = prepareStackAdvisorRequest(request); final ValidationResponse response; try { response = saHelper.validate(validationRequest); } catch (StackAdvisorRequestException e) { LOG.warn("Error occurred during validation", e); throw new IllegalArgumentException(e.getMessage(), e); } catch (StackAdvisorException e) { LOG.warn("Error occurred during validation", e); throw new SystemException(e.getMessage(), e); } Resource validation = createResources(new Command<Resource>() { @Override public Resource invoke() throws AmbariException { Resource resource = new ResourceImpl(Resource.Type.Validation); setResourceProperty(resource, VALIDATION_ID_PROPERTY_ID, response.getId(), getPropertyIds()); setResourceProperty(resource, STACK_NAME_PROPERTY_ID, response.getVersion().getStackName(), getPropertyIds()); setResourceProperty(resource, STACK_VERSION_PROPERTY_ID, response.getVersion().getStackVersion(), getPropertyIds()); List<Map<String, Object>> listItemProps = new ArrayList<>(); Set<ValidationItem> items = response.getItems(); for (ValidationItem item : items) { Map<String, Object> mapItemProps = new HashMap<>(); mapItemProps.put(TYPE_PROPERTY_ID, item.getType()); mapItemProps.put(LEVE_PROPERTY_ID, item.getLevel()); mapItemProps.put(MESSAGE_PROPERTY_ID, item.getMessage()); if (item.getComponentName() != null) { mapItemProps.put(COMPONENT_NAME_PROPERTY_ID, item.getComponentName()); } if (item.getHost() != null) { mapItemProps.put(HOST_PROPERTY_ID, item.getHost()); } if (item.getConfigType() != null) { mapItemProps.put(CONFIG_TYPE_PROPERTY_ID, item.getConfigType()); mapItemProps.put(CONFIG_NAME_PROPERTY_ID, item.getConfigName()); } listItemProps.add(mapItemProps); } setResourceProperty(resource, ITEMS_PROPERTY_ID, listItemProps, getPropertyIds()); return resource; } }); notifyCreate(Resource.Type.Validation, request); Set<Resource> resources = new HashSet<>(Arrays.asList(validation)); return new RequestStatusImpl(null, resources); } protected  ValidationResourceProvider(AmbariManagementController managementController); @Override RequestStatus createResources(final Request request);  }### Answer:
@Test public void testCreateResources_checkRequestId() throws Exception { Map<Resource.Type, String> keyPropertyIds = Collections.emptyMap(); Set<String> propertyIds = Collections.singleton(ValidationResourceProvider.VALIDATION_ID_PROPERTY_ID); AmbariManagementController ambariManagementController = mock(AmbariManagementController.class); ValidationResourceProvider provider = spy(new ValidationResourceProvider(ambariManagementController)); StackAdvisorRequest stackAdvisorRequest = mock(StackAdvisorRequest.class); Request request = mock(Request.class); doReturn(stackAdvisorRequest).when(provider).prepareStackAdvisorRequest(request); StackAdvisorHelper saHelper = mock(StackAdvisorHelper.class); Configuration configuration = mock(Configuration.class); ValidationResponse response = mock(ValidationResponse.class); Version version = mock(Version.class); doReturn(3).when(response).getId(); doReturn(version).when(response).getVersion(); doReturn(response).when(saHelper).validate(any(StackAdvisorRequest.class)); ValidationResourceProvider.init(saHelper, configuration); RequestStatus status = provider.createResources(request); Set<Resource> associatedResources = status.getAssociatedResources(); assertNotNull(associatedResources); assertEquals(1, associatedResources.size()); Resource resource = associatedResources.iterator().next(); Object requestId = resource.getPropertyValue(ValidationResourceProvider.VALIDATION_ID_PROPERTY_ID); assertNotNull(requestId); assertEquals(3, requestId); }