### Question:
RangerBizUtil { public String generatePublicName(VXPortalUser userProfile, XXPortalUser gjUser) { return generatePublicName(userProfile.getFirstName(), userProfile.getLastName()); } RangerBizUtil(); List<? extends XXDBBase> getParentObjects(
			T object); int getClassType(Class<?> klass); void checkSystemAdminAccess(); int getMimeTypeInt(String contentType); String getMimeType(int mimeType); String getImageExtension(String contentType); String getFileNameWithoutExtension(File file); String getDisplayNameForClassName(XXDBBase obj); String getDisplayName(XXDBBase obj); String generatePublicName(VXPortalUser userProfile,
			XXPortalUser gjUser); String generatePublicName(String firstName, String lastName); void updateCloneReferences(XXDBBase obj); Long getForUserId(XXDBBase resource); XXDBBase getMObject(int objClassType, Long objId); XXDBBase getMObject(VXDataObject vXDataObject); VXDataObject getVObject(int objClassType, Long objId); void deleteReferencedObjects(XXDBBase obj); Class<? extends XXDBBase> getContextObject(
			int objectClassType, Long objectId); VXStringList mapStringListToVStringList(List<String> stringList); VXResponse hasPermission(VXResource vXResource, int permission); boolean isAdmin(); String getCurrentUserLoginId(); Long getXUserId(); boolean matchHbasePolicy(String resourceName,
			List<XXResource> xResourceList, VXResponse vXResponse,
			Long xUserId, int permission); boolean matchHivePolicy(String resourceName,
			List<XXResource> xResourceList, Long xUserId, int permission); boolean matchHivePolicy(String resourceName,
			List<XXResource> xResourceList, Long xUserId, int permission,
			int reqTableType, int reqColumnType, boolean isUdfPolicy); String replaceMetaChars(String path); Long getPublicGroupId(); boolean isGroupInList(Long groupId, List<XXGroup> xGroupList); boolean isRecursiveWildCardMatch(String pathToCheck,
			String wildcardPath); List<Integer> getResorceTypeParentHirearchy(int resourceType,
			int assetType); boolean comparePathsForExactMatch(String path1, String path2); boolean nonRecursiveWildCardMatch(String pathToCheck,
			String wildcardPath); static boolean areAllEqual(int checkValue, int... otherValues); void createTrxLog(List<XXTrxLog> trxLogList); static int getDBFlavor(); String getAuditDBType(); void setAuditDBType(String auditDBType); boolean isKeyAdmin(); Boolean hasAccess(XXDBBase xxDbBase, RangerBaseModelObject baseModel); void hasAdminPermissions(String objType); void hasKMSPermissions(String objType, String implClassName); boolean checkUserAccessible(VXUser vXUser); final String EMPTY_CONTENT_DISPLAY_NAME; static final String AUDIT_STORE_RDBMS; static final String AUDIT_STORE_SOLR; }### Answer:
@Test public void testGeneratePublicName(){ String firstName = "Test123456789123456789"; String lastName = "Unit"; String publicNameChk = rangerBizUtil.generatePublicName(firstName, lastName); Assert.assertEquals("Test12345678... U.", publicNameChk); }
@Test public void testGeneratePublicName_fNameLessThanMax(){ String firstName = "Test"; String lastName = ""; String publicNameChk = rangerBizUtil.generatePublicName(firstName, lastName); Assert.assertNull(publicNameChk); }
@Test public void testGeneratePublicName_withPortalUser(){ VXPortalUser vXPortalUser = new VXPortalUser(); vXPortalUser.setFirstName("Test"); vXPortalUser.setLastName(null); String publicNameChk = rangerBizUtil.generatePublicName(vXPortalUser, null); Assert.assertNull(publicNameChk); }