### Question:
ProcessHandler { public void addProcessPortRelationship(String userId, String processGUID, String portGUID, String externalSourceName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { dataEngineCommonHandler.createOrUpdateExternalRelationship(userId, processGUID, portGUID, ProcessPropertiesMapper.PROCESS_PORT_TYPE_NAME, ProcessPropertiesMapper.PROCESS_TYPE_NAME, externalSourceName, null); } 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 addProcessPortRelationship() throws UserNotAuthorizedException, PropertyServerException, InvalidParameterException { processHandler.addProcessPortRelationship(USER, PROCESS_GUID, GUID, EXTERNAL_SOURCE_DE_QUALIFIED_NAME); verify(dataEngineCommonHandler, times(1)).createOrUpdateExternalRelationship(USER, PROCESS_GUID, GUID, ProcessPropertiesMapper.PROCESS_PORT_TYPE_NAME, ProcessPropertiesMapper.PROCESS_TYPE_NAME, EXTERNAL_SOURCE_DE_QUALIFIED_NAME, null); }
@Test void addProcessPortRelationship_throwsUserNotAuthorizedException() throws UserNotAuthorizedException, PropertyServerException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvalidParameterException { String methodName = "addProcessPortRelationship"; UserNotAuthorizedException mockedException = mockException(UserNotAuthorizedException.class, methodName); doThrow(mockedException).when(dataEngineCommonHandler).createOrUpdateExternalRelationship(USER, PROCESS_GUID, GUID, ProcessPropertiesMapper.PROCESS_PORT_TYPE_NAME, ProcessPropertiesMapper.PROCESS_TYPE_NAME, EXTERNAL_SOURCE_DE_QUALIFIED_NAME, null); UserNotAuthorizedException thrown = assertThrows(UserNotAuthorizedException.class, () -> processHandler.addProcessPortRelationship(USER, PROCESS_GUID, GUID, EXTERNAL_SOURCE_DE_QUALIFIED_NAME)); assertTrue(thrown.getMessage().contains("OMAS-DATA-ENGINE-404-001 ")); }