1 package org.openecomp.sdc.common.util;
5 import org.junit.Assert;
9 public class ValidationUtilsTest {
11 private ValidationUtils createTestSubject() {
12 return new ValidationUtils();
17 public void testValidateArtifactLabel() throws Exception {
22 result = ValidationUtils.validateArtifactLabel(label);
27 public void testValidateArtifactDisplayName() throws Exception {
28 String displayName = "";
32 result = ValidationUtils.validateArtifactDisplayName(displayName);
39 public void testNormalizeCategoryName4Display() throws Exception {
45 result = ValidationUtils.normalizeCategoryName4Display(str);
46 Assert.assertEquals("123", result);
50 result = ValidationUtils.normalizeCategoryName4Display(str);
51 Assert.assertEquals("123#123", result);
56 public void testNormalizeCategoryName4Uniqueness() throws Exception {
61 result = ValidationUtils.normalizeCategoryName4Uniqueness(str);
66 public void testValidateCategoryDisplayNameLength() throws Exception {
71 result = ValidationUtils.validateCategoryDisplayNameLength(label);
76 public void testValidateProductFullNameLength() throws Exception {
81 result = ValidationUtils.validateProductFullNameLength(fullName);
86 public void testValidateArtifactLabelLength() throws Exception {
91 result = ValidationUtils.validateArtifactLabelLength(label);
96 public void testValidateResourceInstanceNameLength() throws Exception {
97 String resourceInstanceName = "";
101 result = ValidationUtils.validateResourceInstanceNameLength(resourceInstanceName);
106 public void testValidateResourceInstanceName() throws Exception {
107 String resourceInstanceName = "";
111 result = ValidationUtils.validateResourceInstanceName(resourceInstanceName);
116 public void testValidateUrlLength() throws Exception {
121 result = ValidationUtils.validateUrlLength(url);
126 public void testValidateArtifactNameLength() throws Exception {
127 String artifactName = "";
131 result = ValidationUtils.validateArtifactNameLength(artifactName);
136 public void testValidateComponentNamePattern() throws Exception {
137 String componentName = "";
141 result = ValidationUtils.validateComponentNamePattern(componentName);
146 public void testValidateComponentNameLength() throws Exception {
147 String componentName = "";
151 result = ValidationUtils.validateComponentNameLength(componentName);
156 public void testValidateIcon() throws Exception {
161 result = ValidationUtils.validateIcon(icon);
166 public void testValidateIconLength() throws Exception {
171 result = ValidationUtils.validateIconLength(icon);
176 public void testValidateProjectCode() throws Exception {
177 String projectCode = "";
181 result = ValidationUtils.validateProjectCode(projectCode);
186 public void testValidateProjectCodeLegth() throws Exception {
187 String projectCode = "";
191 result = ValidationUtils.validateProjectCodeLegth(projectCode);
196 public void testValidateContactId() throws Exception {
197 String contactId = "";
201 result = ValidationUtils.validateContactId(contactId);
206 public void testValidateCost() throws Exception {
211 result = ValidationUtils.validateCost(cost);
216 public void testRemoveHtmlTags() throws Exception {
221 result = ValidationUtils.removeHtmlTags(str);
226 public void testRemoveAllTags() throws Exception {
227 String htmlText = "";
231 result = ValidationUtils.removeAllTags(htmlText);
236 public void testNormaliseWhitespace() throws Exception {
241 result = ValidationUtils.normaliseWhitespace(str);
246 public void testStripOctets() throws Exception {
251 result = ValidationUtils.stripOctets(str);
256 public void testRemoveNoneUtf8Chars() throws Exception {
261 result = ValidationUtils.removeNoneUtf8Chars(input);
266 public void testValidateIsEnglish() throws Exception {
271 result = ValidationUtils.validateIsEnglish(input);
276 public void testValidateIsAscii() throws Exception {
281 result = ValidationUtils.validateIsAscii(input);
286 public void testConvertHtmlTagsToEntities() throws Exception {
291 result = ValidationUtils.convertHtmlTagsToEntities(input);
302 public void testValidateTagListLength() throws Exception {
303 int tagListLength = 0;
307 result = ValidationUtils.validateTagListLength(tagListLength);
312 public void testValidateDescriptionLength() throws Exception {
313 String description = "";
317 result = ValidationUtils.validateDescriptionLength(description);
322 public void testValidateStringNotEmpty() throws Exception {
328 result = ValidationUtils.validateStringNotEmpty(value);
329 Assert.assertEquals(false, result);
333 result = ValidationUtils.validateStringNotEmpty(value);
334 Assert.assertEquals(false, result);
339 public void testValidateListNotEmpty() throws Exception {
345 result = ValidationUtils.validateListNotEmpty(list);
346 Assert.assertEquals(false, result);
351 public void testValidateVendorName() throws Exception {
352 String vendorName = "";
356 result = ValidationUtils.validateVendorName(vendorName);
361 public void testValidateVendorNameLength() throws Exception {
362 String vendorName = "";
366 result = ValidationUtils.validateVendorNameLength(vendorName);
371 public void testValidateResourceVendorModelNumberLength() throws Exception {
372 String resourceVendorModelNumber = "";
376 result = ValidationUtils.validateResourceVendorModelNumberLength(resourceVendorModelNumber);
381 public void testValidateVendorRelease() throws Exception {
382 String vendorRelease = "";
386 result = ValidationUtils.validateVendorRelease(vendorRelease);
391 public void testValidateVendorReleaseLength() throws Exception {
392 String vendorRelease = "";
396 result = ValidationUtils.validateVendorReleaseLength(vendorRelease);
401 public void testValidateServiceTypeLength() throws Exception {
402 String serviceType = "";
406 result = ValidationUtils.validateServiceTypeLength(serviceType);
411 public void testValidateServiceRoleLength() throws Exception {
412 String serviceRole = "";
416 result = ValidationUtils.validateServiceRoleLength(serviceRole);
421 public void testHasBeenCertified() throws Exception {
426 result = ValidationUtils.hasBeenCertified(version);
431 public void testNormaliseComponentName() throws Exception {
436 result = ValidationUtils.normaliseComponentName(name);
441 public void testNormalizeComponentInstanceName() throws Exception {
446 result = ValidationUtils.normalizeComponentInstanceName(name);
454 public void testConvertToSystemName() throws Exception {
459 result = ValidationUtils.convertToSystemName(name);
464 public void testNormalizeFileName() throws Exception {
465 String filename = "";
469 result = ValidationUtils.normalizeFileName(filename);
477 public void testValidateUrl() throws Exception {
482 result = ValidationUtils.validateUrl(url);
487 public void testCleanArtifactDisplayName() throws Exception {
492 result = ValidationUtils.cleanArtifactDisplayName(strIn);
497 public void testNormalizeArtifactLabel() throws Exception {
502 result = ValidationUtils.normalizeArtifactLabel(strIn);
507 public void testValidateAdditionalInformationKeyName() throws Exception {
512 result = ValidationUtils.validateAdditionalInformationKeyName(str);
523 public void testValidateConsumerName() throws Exception {
524 String consumerName = "";
528 result = ValidationUtils.validateConsumerName(consumerName);
533 public void testIsUTF8Str() throws Exception {
538 result = ValidationUtils.isUTF8Str(str);
543 public void testValidateConsumerPassSalt() throws Exception {
544 String consumerSalt = "";
548 result = ValidationUtils.validateConsumerPassSalt(consumerSalt);
553 public void testIsFloatNumber() throws Exception {
558 result = ValidationUtils.isFloatNumber(number);
563 public void testValidateCertifiedVersion() throws Exception {
568 result = ValidationUtils.validateCertifiedVersion(version);
573 public void testValidateMinorVersion() throws Exception {
578 result = ValidationUtils.validateMinorVersion(version);
583 public void testNormaliseProductName() throws Exception {
588 result = ValidationUtils.normaliseProductName(name);
596 public void testRemoveHtmlTagsOnly() throws Exception {
597 String htmlText = "";
601 result = ValidationUtils.removeHtmlTagsOnly(htmlText);