### Question:
ProcessHandler { public Set<String> getPortsForProcess(String userId, String processGUID, String portTypeName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "getPortsForProcess"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateGUID(processGUID, ProcessPropertiesMapper.GUID_PROPERTY_NAME, methodName); TypeDef relationshipTypeDef = repositoryHelper.getTypeDefByName(userId, ProcessPropertiesMapper.PROCESS_PORT_TYPE_NAME); List<EntityDetail> entities = repositoryHandler.getEntitiesForRelationshipType(userId, processGUID, ProcessPropertiesMapper.PROCESS_TYPE_NAME, relationshipTypeDef.getGUID(), relationshipTypeDef.getName(), 0, 0, methodName); if (CollectionUtils.isEmpty(entities)) { return new HashSet<>(); } return entities.parallelStream().filter(entityDetail -> entityDetail.getType().getTypeDefName().equalsIgnoreCase(portTypeName)) .map(InstanceHeader::getGUID).collect(Collectors.toSet()); } 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 getPortsForProcess() throws UserNotAuthorizedException, PropertyServerException, InvalidParameterException { final String methodName = "getPortsForProcess"; mockTypeDef(ProcessPropertiesMapper.PROCESS_PORT_TYPE_NAME, ProcessPropertiesMapper.PROCESS_PORT_TYPE_GUID); EntityDetail portImplementation = mock(EntityDetail.class); InstanceType mockedTypeImpl = mock(InstanceType.class); when(mockedTypeImpl.getTypeDefName()).thenReturn(PortPropertiesMapper.PORT_IMPLEMENTATION_TYPE_NAME); when(portImplementation.getType()).thenReturn(mockedTypeImpl); when(portImplementation.getGUID()).thenReturn(PORT_IMPL_GUID); EntityDetail portAlias = mock(EntityDetail.class); InstanceType mockedTypeAlias = mock(InstanceType.class); when(mockedTypeAlias.getTypeDefName()).thenReturn(PortPropertiesMapper.PORT_ALIAS_TYPE_NAME); when(portAlias.getType()).thenReturn(mockedTypeImpl); when(portAlias.getGUID()).thenReturn(PORT_ALIAS_GUID); List<EntityDetail> portEntityGUIDs = Arrays.asList(portAlias, portImplementation); when(repositoryHandler.getEntitiesForRelationshipType(USER, PROCESS_GUID, ProcessPropertiesMapper.PROCESS_TYPE_NAME, ProcessPropertiesMapper.PROCESS_PORT_TYPE_GUID, ProcessPropertiesMapper.PROCESS_PORT_TYPE_NAME, 0, 0, methodName)).thenReturn(portEntityGUIDs); Set<String> resultGUIDs = processHandler.getPortsForProcess(USER, PROCESS_GUID, PortPropertiesMapper.PORT_IMPLEMENTATION_TYPE_NAME); assertEquals(2, resultGUIDs.size()); assertTrue(resultGUIDs.contains(PORT_IMPL_GUID)); assertTrue(resultGUIDs.contains(PORT_ALIAS_GUID)); }