### Question:
AssetCatalogHandler { public List<org.odpi.openmetadata.accessservices.assetcatalog.model.Classification> getEntityClassificationByName(String userId, String assetGUID, String assetTypeName, String classificationName) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException { String methodName = "getEntityClassificationByName"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateGUID(assetGUID, GUID_PARAMETER, methodName); List<Classification> entityClassifications = getEntityClassifications(userId, assetGUID, assetTypeName); if (CollectionUtils.isEmpty(entityClassifications)) { return Collections.emptyList(); } if (classificationName != null) { entityClassifications = filterClassificationByName(entityClassifications, classificationName); } return assetConverter.convertClassifications(entityClassifications); } AssetCatalogHandler(String serverUserName, String sourceName, InvalidParameterHandler invalidParameterHandler,
                               RepositoryHandler repositoryHandler, OMRSRepositoryHelper repositoryHelper,
                               RepositoryErrorHandler errorHandler, List<String> supportedZones, List<String> supportedTypesForSearch); AssetDescription getEntityDetails(String userId, String assetGUID, String assetTypeName); List<org.odpi.openmetadata.accessservices.assetcatalog.model.Relationship> getRelationshipsByEntityGUID(String userId,
                                                                                                                   String assetGUID,
                                                                                                                   String assetTypeName); List<org.odpi.openmetadata.accessservices.assetcatalog.model.Classification> getEntityClassificationByName(String userId,
                                                                                                                      String assetGUID,
                                                                                                                      String assetTypeName,
                                                                                                                      String classificationName); List<org.odpi.openmetadata.accessservices.assetcatalog.model.Relationship> getLinkingRelationshipsBetweenAssets(String serverName,
                                                                                                                           String userId,
                                                                                                                           String startAssetGUID,
                                                                                                                           String endAssetGUID); List<org.odpi.openmetadata.accessservices.assetcatalog.model.Relationship> getRelationships(String userId,
                                                                                                       String assetGUID,
                                                                                                       String assetTypeName,
                                                                                                       String relationshipTypeName,
                                                                                                       Integer from, Integer pageSize); List<AssetDescription> getIntermediateAssets(String userId, String startAssetGUID, String endAssetGUID); List<AssetDescription> getEntitiesFromNeighborhood(String serverName, String userId, String assetGUID, SearchParameters searchParameters); List<AssetElements> searchByType(String userId, String searchCriteria, SearchParameters searchParameters); AssetElements buildContextByType(String userId,
                                            String entityGUID,
                                            String entityTypeDefName); List<Type> getSupportedTypes(String userId, String typeName);  }### Answer:
@Test public void getEntityClassificationByName() throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, RepositoryErrorException { String methodName = "getEntityClassificationByName"; mockMetadataCollection(); mockEntityDetails(FIRST_GUID); List<Classification> result = assetCatalogHandler .getEntityClassificationByName(USER, FIRST_GUID, ASSET_TYPE, CLASSIFICATION_NAME); assertEquals(CLASSIFICATION_NAME, result.get(0).getName()); verify(invalidParameterHandler, times(1)).validateUserId(USER, methodName); verify(invalidParameterHandler, times(1)).validateGUID(FIRST_GUID, GUID_PARAMETER, methodName); }
@Test public void getEntityClassificationByName_throwsInvalidParameterException() throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, RepositoryErrorException { String methodName = "getEntityClassificationByName"; mockMetadataCollection(); mockEntityDetails(FIRST_GUID); doThrow(new org.odpi.openmetadata.commonservices.ffdc.exceptions.InvalidParameterException(AssetCatalogErrorCode.SERVICE_NOT_INITIALIZED.getMessageDefinition(), this.getClass().getName(), "", "")) .when(invalidParameterHandler).validateUserId(USER, methodName); assertThrows(InvalidParameterException.class, () -> assetCatalogHandler.getEntityClassificationByName(USER, FIRST_GUID, ASSET_TYPE, CLASSIFICATION_NAME)); }