### Question:
ProcessHandler { public String createProcess(String userId, Process process, String externalSourceName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "createProcess"; initializeAssetZoneMembership(process); securityVerifier.validateUserForAssetCreate(userId, process); validateProcessParameters(userId, process.getQualifiedName(), methodName); ProcessPropertiesBuilder builder = new ProcessPropertiesBuilder(process.getQualifiedName(), process.getName(), process.getDisplayName(), process.getDescription(), process.getOwner(), process.getOwnerType(), process.getZoneMembership(), process.getLatestChange(), process.getFormula(), null, null, repositoryHelper, serverName, serviceName); String processGUID = dataEngineCommonHandler.createExternalEntity(userId, builder.getInstanceProperties(methodName), InstanceStatus.DRAFT, ProcessPropertiesMapper.PROCESS_TYPE_NAME, externalSourceName); classifyAsset(userId, process, processGUID); return processGUID; } ProcessHandler(String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler,
                          RepositoryHandler repositoryHandler, OMRSRepositoryHelper repositoryHelper, AssetHandler assetHandler,
                          DataEngineCommonHandler dataEngineCommonHandler, List<String> defaultZones, List<String> supportedZones); void setSecurityVerifier(OpenMetadataServerSecurityVerifier securityVerifier); String createProcess(String userId, Process process, String externalSourceName); void updateProcess(String userId, EntityDetail originalProcessEntity, Process updatedProcess); Optional<EntityDetail> findProcessEntity(String userId, String qualifiedName); void addProcessPortRelationship(String userId, String processGUID, String portGUID, String externalSourceName); void updateProcessStatus(String userId, String guid, InstanceStatus instanceStatus); Set<String> getPortsForProcess(String userId, String processGUID, String portTypeName); void createOrUpdateProcessHierarchyRelationship(String userId, ParentProcess parentProcess, String processGUID,
                                                           String externalSourceName);  }### Answer:
@Test void createProcess() throws UserNotAuthorizedException, PropertyServerException, InvalidParameterException { String methodName = "createProcess"; mockTypeDef(ProcessPropertiesMapper.PROCESS_TYPE_NAME, ProcessPropertiesMapper.PROCESS_TYPE_GUID); when(dataEngineCommonHandler.createExternalEntity(USER, null, InstanceStatus.DRAFT, ProcessPropertiesMapper.PROCESS_TYPE_NAME, EXTERNAL_SOURCE_DE_QUALIFIED_NAME)).thenReturn(GUID); when(securityVerifier.initializeAssetZones(any(), any())).thenReturn(ZONES); String result = processHandler.createProcess(USER, getProcess(), EXTERNAL_SOURCE_DE_QUALIFIED_NAME); assertEquals(GUID, result); verify(invalidParameterHandler, times(1)).validateUserId(USER, methodName); verify(invalidParameterHandler, times(1)).validateName(QUALIFIED_NAME, ProcessPropertiesMapper.QUALIFIED_NAME_PROPERTY_NAME, methodName); verify(repositoryHandler, times(1)).classifyEntity(USER, GUID, AssetMapper.ASSET_ZONES_CLASSIFICATION_GUID, AssetMapper.ASSET_ZONES_CLASSIFICATION_NAME, null, "classifyAsset"); verify(repositoryHandler, times(1)).classifyEntity(USER, GUID, AssetMapper.ASSET_OWNERSHIP_CLASSIFICATION_GUID, AssetMapper.ASSET_OWNERSHIP_CLASSIFICATION_NAME, null, "classifyAsset"); }
@Test void createProcess_throwsUserNotAuthorizedException() throws UserNotAuthorizedException, PropertyServerException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvalidParameterException { String methodName = "createProcess"; UserNotAuthorizedException mockedException = mockException(UserNotAuthorizedException.class, methodName); when(dataEngineCommonHandler.createExternalEntity(USER, null, InstanceStatus.DRAFT, ProcessPropertiesMapper.PROCESS_TYPE_NAME, EXTERNAL_SOURCE_DE_QUALIFIED_NAME)).thenThrow(mockedException); UserNotAuthorizedException thrown = assertThrows(UserNotAuthorizedException.class, () -> processHandler.createProcess(USER, getProcess(), EXTERNAL_SOURCE_DE_QUALIFIED_NAME)); assertTrue(thrown.getMessage().contains("OMAS-DATA-ENGINE-404-001 ")); }