Improve handling 'empty'/null string in Service fields
[sdc.git] / common-app-api / src / test / java / org / openecomp / sdc / common / util / ValidationUtilsTest.java
index 2c4e0b7..3408c68 100644 (file)
-package org.openecomp.sdc.common.util;
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
 
-import java.util.List;
 
-import javax.annotation.Generated;
+package org.openecomp.sdc.common.util;
 
-import org.junit.Assert;
+import com.google.common.collect.Lists;
 import org.junit.Test;
 
+import java.util.Collections;
+import java.util.List;
+
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertTrue;
+
 
 public class ValidationUtilsTest {
 
-       private ValidationUtils createTestSubject() {
-               return new ValidationUtils();
+       @Test
+       public void checkValidateArtifactLabelReturnsTrueIfInputIsValid() {
+               final String testLabel = "testArtifactLabel";
+
+               boolean result = ValidationUtils.validateArtifactLabel(testLabel);
+
+               assertTrue(result);
+       }
+
+       @Test
+       public void checkValidateArtifactLabelReturnsFalseIfInputIsInvalid() {
+               final String testLabel = "wrong*()ArtifactLABEL+=";
+
+               boolean result = ValidationUtils.validateArtifactLabel(testLabel);
+
+               assertFalse(result);
+       }
+
+       @Test
+       public void checkValidateArtifactLabelReturnsFalseIfInputIsEmpty() {
+               final String testLabel = "";
+
+               boolean result = ValidationUtils.validateArtifactLabel(testLabel);
+
+               assertFalse(result);
+       }
+
+       @Test
+       public void checkValidateArtifactDisplayNameReturnsTrueIfInputIsValid() {
+               final String testDisplayName = "testDisplayName";
+
+               boolean result = ValidationUtils.validateArtifactDisplayName(testDisplayName);
+
+               assertTrue(result);
+       }
+
+       @Test
+       public void checkValidateArtifactDisplayNameReturnsFalseIfInputIsInvalid() {
+               final String testDisplayName = "wrong*()DisplayNAME+=";
+
+               boolean result = ValidationUtils.validateArtifactDisplayName(testDisplayName);
+
+               assertFalse(result);
+       }
+
+       @Test
+       public void checkValidateArtifactDisplayNameReturnsFalseIfInputIsEmpty() {
+               final String testDisplayName = "";
+
+               boolean result = ValidationUtils.validateArtifactDisplayName(testDisplayName);
+
+               assertFalse(result);
+       }
+
+       @Test
+       public void checkValidateCategoryDisplayNameFormatReturnsTrueIfInputIsValid() {
+               final String testCatalogDisplayName = "testCatalogDisplayName";
+
+               boolean result = ValidationUtils.validateCategoryDisplayNameFormat(testCatalogDisplayName);
+
+               assertTrue(result);
+       }
+
+       @Test
+       public void checkValidateCategoryDisplayNameLengthReturnsTrueIfNameIsBetweenMinAndMax() {
+               final String testCatalogDisplayName = "testCatalogDisplayName";
+
+               boolean result = ValidationUtils.validateCategoryDisplayNameLength(testCatalogDisplayName);
+
+               assertTrue(result);
+       }
+
+       @Test
+       public void checkValidateCategoryDisplayNameLengthReturnsFalseIfNameIsToLong() {
+               final String testCatalogDisplayName = "testCatalogVeryLongDisplayName";
+
+               boolean result = ValidationUtils.validateCategoryDisplayNameLength(testCatalogDisplayName);
+
+               assertFalse(result);
+       }
+
+       @Test
+       public void checkValidateCategoryDisplayNameLengthReturnsFalseIfNameIsToShort() {
+               final String testCatalogDisplayName = "Na";
+
+               boolean result = ValidationUtils.validateCategoryDisplayNameLength(testCatalogDisplayName);
+
+               assertFalse(result);
+       }
+
+       @Test
+       public void checkValidateProductFullNameLengthReturnsTrueIfNameIsBetweenMinAndMax() {
+               final String testProductFullName = "testProductFullName";
+
+               boolean result = ValidationUtils.validateProductFullNameLength(testProductFullName);
+
+               assertTrue(result);
+       }
+
+       @Test
+       public void checkValidateProductFullNameLengthReturnsTrueIfNameIsToLong() {
+               final String testProductFullName =
+                               "testProductVeryVeryLongFullNameThatIsToLong" +
+                                               "ToPassValidationBecauseItExceedsTheMaxLengthOfThatParameter";
+
+               boolean result = ValidationUtils.validateProductFullNameLength(testProductFullName);
+
+               assertFalse(result);
+       }
+
+       @Test
+       public void checkValidateProductFullNameLengthReturnsTrueIfNameIsToShort() {
+               final String testProductFullName = "tes";
+
+               boolean result = ValidationUtils.validateProductFullNameLength(testProductFullName);
+
+               assertFalse(result);
+       }
+
+       @Test
+       public void checkValidateArtifactLabelLengthReturnsTrueIfNameIsBetweenMinAndMax() {
+               final String testArtifactLabel = "testArtifactLabel";
+
+               boolean result = ValidationUtils.validateArtifactLabelLength(testArtifactLabel);
+
+               assertTrue(result);
+       }
+
+       @Test
+       public void checkValidateArtifactLabelLengthReturnsFalseIfNameIsToLong() {
+               final String testArtifactLabel = generateLongString(300);
+
+               boolean result = ValidationUtils.validateArtifactLabelLength(testArtifactLabel);
+
+               assertFalse(result);
+       }
+
+       @Test
+       public void checkValidateResourceInstanceNameLengthReturnsTrueIfNameIsBetweenMinAndMax() {
+               final String testResourceInstanceName = "testResourceInstanceName";
+
+               boolean result = ValidationUtils.validateResourceInstanceNameLength(testResourceInstanceName);
+
+               assertTrue(result);
+       }
+
+       @Test
+       public void checkValidateResourceInstanceNameReturnsTrueIfNameIsCorrect() {
+               final String testResourceInstanceName = "testResourceInstanceName";
+
+               boolean result = ValidationUtils.validateResourceInstanceName(testResourceInstanceName);
+
+               assertTrue(result);
+       }
+
+       @Test
+       public void checkValidateResourceInstanceNameReturnsFalseIfNameIsNotCorrect() {
+               final String testResourceInstanceName = "wrong!@#resourceInstance\nName=+";
+
+               boolean result = ValidationUtils.validateResourceInstanceName(testResourceInstanceName);
+
+               assertFalse(result);
+       }
+
+       @Test
+       public void checkValidateUrlLengthReturnsTrueIfUrlLengthIsBetweenMinAndMax() {
+               final String testURL = "test/url/";
+
+               boolean result = ValidationUtils.validateUrlLength(testURL);
+
+               assertTrue(result);
+       }
+
+       @Test
+       public void checkValidateUrlLengthReturnsFalseIfUrlLengthIsToLong() {
+               final String testURL = generateLongString(120);
+
+               boolean result = ValidationUtils.validateUrlLength(testURL);
+
+               assertFalse(result);
+       }
+
+       @Test
+       public void checkValidateArtifactNameLengthReturnsTrueIfUrlLengthIsBetweenMinAndMax() {
+               final String testArtifactNameLength = "testArtifact";
+
+               boolean result = ValidationUtils.validateArtifactNameLength(testArtifactNameLength);
+
+               assertTrue(result);
+       }
+
+       @Test
+       public void checkValidateArtifactNameLengthReturnsFalseIfUrlLengthIsToLong() {
+               final String testArtifactNameLength = generateLongString(260);
+
+               boolean result = ValidationUtils.validateArtifactNameLength(testArtifactNameLength);
+
+               assertFalse(result);
+       }
+
+       @Test
+       public void checkValidateComponentNamePatternReturnsTrueIfNameMatchesPattern() {
+               final String testComponentName = "testComponent";
+
+               boolean result = ValidationUtils.validateComponentNamePattern(testComponentName);
+
+               assertTrue(result);
+       }
+
+       @Test
+       public void checkValidateComponentNamePatternReturnsFalseIfNameDoesNotMatchesPattern() {
+               final String testComponentName = "testWRONG!@#Component+!";
+
+               boolean result = ValidationUtils.validateComponentNamePattern(testComponentName);
+
+               assertFalse(result);
+       }
+
+       @Test
+       public void checkValidateComponentNameLengthReturnsTrueIfNameLengthIsBetweenMinAndMax() {
+               final String testComponentName = "testComponent";
+
+               boolean result = ValidationUtils.validateComponentNameLength(testComponentName);
+
+               assertTrue(result);
+       }
+
+       @Test
+       public void checkValidateComponentNameLengthReturnsFalseIfNameLengthIsToLong() {
+               final String testComponentName = generateLongString(1100);
+
+               boolean result = ValidationUtils.validateComponentNameLength(testComponentName);
+
+               assertFalse(result);
+       }
+
+       @Test
+       public void checkValidateIconReturnsTrueIfIconMatchesPattern() {
+               final String testIcon = "icon";
+
+               boolean result = ValidationUtils.validateIcon(testIcon);
+
+               assertTrue(result);
+       }
+
+       @Test
+       public void checkValidateIconReturnsFalseIfIconDoesNotMatchesPattern() {
+               final String testIcon = "icon,";
+
+               boolean result = ValidationUtils.validateIcon(testIcon);
+
+               assertFalse(result);
+       }
+
+       @Test
+       public void checkValidateIconLengthReturnsTrueIfILengthIsBetweenMinAndMax() {
+               final String testIcon = "icon";
+
+               boolean result = ValidationUtils.validateIconLength(testIcon);
+
+               assertTrue(result);
+       }
+
+       @Test
+       public void checkValidateIconLengthReturnsTrueFalseIfILengthIsToLong() {
+               final String testIcon = generateLongString(30);
+
+               boolean result = ValidationUtils.validateIconLength(testIcon);
+
+               assertFalse(result);
+       }
+
+       @Test
+       public void checkValidateProjectCodeReturnsTrueIfCodeMatchesPattern() {
+               final String testProjectCode = "testProjectCode";
+
+               boolean result = ValidationUtils.validateProjectCode(testProjectCode);
+
+               assertTrue(result);
+       }
+
+       @Test
+       public void checkValidateProjectCodeReturnsFalseIfCodeDoesNotMatchesPattern() {
+               final String testProjectCode = "testWRONG!@#ProjectCode";
+
+               boolean result = ValidationUtils.validateProjectCode(testProjectCode);
+
+               assertFalse(result);
        }
 
-       
        @Test
-       public void testValidateArtifactLabel() throws Exception {
-               String label = "";
-               boolean result;
+       public void checkValidateProjectCodeLengthReturnsTrueIfCodeMatchesPattern() {
+               final String testProjectCode = "testProjectCode";
 
-               // default test
-               result = ValidationUtils.validateArtifactLabel(label);
+               boolean result = ValidationUtils.validateProjectCodeLegth(testProjectCode);
+
+               assertTrue(result);
+       }
+
+       @Test
+       public void checkValidateContactIdReturnsTrueIfIdMatchesPattern() {
+               final String testContactId = "testContactId";
+
+               boolean result = ValidationUtils.validateContactId(testContactId);
+
+               assertTrue(result);
+       }
+
+       @Test
+       public void checkValidateCostReturnsTrueIfIdMatchesPattern() {
+               final String testCost = "120.15";
+
+               boolean result = ValidationUtils.validateCost(testCost);
+
+               assertTrue(result);
+       }
+
+       @Test
+       public void validateRemoveHtmlTagsReturnsStringWithNoHTMLTags() {
+               final String htmlString = "<div>test with <p>tags</p></div>";
+
+               String result = ValidationUtils.removeHtmlTags(htmlString);
+
+               assertEquals(result, "test with tags");
+       }
+
+       @Test
+       public void validateRemoveAllTagsReturnsStringWithNoHTMLTags() {
+               final String htmlString = "<div>test with <p>tags</p></div>";
+
+               String result = ValidationUtils.removeAllTags(htmlString);
+
+               assertEquals(result, "test with tags");
+       }
+
+       @Test
+       public void validateNormalizeWhitespaceReturnsStringWithNormalizedWhitespace() {
+               final String whitespaceString = "test   normalize  whitespace";
+
+               String result = ValidationUtils.normaliseWhitespace(whitespaceString);
+
+               assertEquals(result, "test normalize whitespace");
+       }
+
+       @Test
+       public void validateStripOctetsReturnsStringWithNormalizedWhitespace() {
+               final String octedString = "%2Dtest strip octets text";
+
+               String result = ValidationUtils.stripOctets(octedString);
+
+               assertEquals(result, "test strip octets text");
+       }
+
+       @Test
+       public void validateRemoveNoneUtf8CharsRemovesCharacterThatAreNotFromUtf8() {
+               final String nonUtf8String = "test קקUtf8 קק textקק";
+
+               String result = ValidationUtils.removeNoneUtf8Chars(nonUtf8String);
+
+               assertEquals(result, "test Utf8  text");
+       }
+
+       @Test
+       public void validateIsEnglishReturnsTrueIfStringContainsOnlyEnglishCharacters() {
+               final String nonUtf8String = "test english text";
+
+               boolean result = ValidationUtils.validateIsEnglish(nonUtf8String);
+
+               assertTrue(result);
        }
 
-       
        @Test
-       public void testValidateArtifactDisplayName() throws Exception {
-               String displayName = "";
-               boolean result;
+       public void validateIsEnglishReturnsFalseIfStringContainsNoEnglishCharacters() {
+               final String nonUtf8String = "test noEnglish text文";
 
-               // default test
-               result = ValidationUtils.validateArtifactDisplayName(displayName);
+               boolean result = ValidationUtils.validateIsEnglish(nonUtf8String);
+
+               assertFalse(result);
+       }
+
+       @Test
+       public void validateIsAsciiReturnsTrueIfStringContainsOnlyAsciiCharacters() {
+               final String testAsciiText = "ascii text";
+
+               boolean result = ValidationUtils.validateIsAscii(testAsciiText);
+
+               assertTrue(result);
+       }
+
+       @Test
+       public void validateIsAsciiReturnsFalseIfStringContainsNotAsciiCharacter() {
+               final String testAsciiText = "no ascii text ┬á";
+
+               boolean result = ValidationUtils.validateIsAscii(testAsciiText);
+
+               assertFalse(result);
        }
 
-       
+       @Test
+       public void validateConvertHtmlTagsToEntitiesReturnsStringWithReplacedTags() {
+               final String testAsciiText = "<div>ascii text</div>";
+
+               String result = ValidationUtils.convertHtmlTagsToEntities(testAsciiText);
+
+               assertEquals(result, "&lt;div&gt;ascii text&lt;/div&gt;");
+       }
+
+
+       @Test
+       public void validateRemoveDuplicateFromListReturnsListWithoutDuplicates() {
+               List<String> listOfDuplicates =
+                               Lists.newArrayList("text01","text01","text02","text02","text02","text03");
+
+               List<String> result = ValidationUtils.removeDuplicateFromList(listOfDuplicates);
+
+               assertTrue(result.containsAll(Lists.newArrayList("text01","text03","text03")));
+               assertEquals(result.size(), 3);
+       }
 
-       
        @Test
-       public void testNormalizeCategoryName4Display() throws Exception {
-               String str = "";
-               String result;
+       public void checkValidateTagLengthReturnsTrueIfTagIsBetweenMaxAndMin() {
+               final String testTag = "testTag";
+
+               boolean result = ValidationUtils.validateTagLength(testTag);
+
+               assertTrue(result);
+       }
+
+       @Test
+       public void checkValidateTagLengthReturnsFalseIfTagIsToLong() {
+               final String testTag = generateLongString(1200);
+
+               boolean result = ValidationUtils.validateTagLength(testTag);
+
+               assertFalse(result);
+       }
+
+       @Test
+       public void checkValidateTagLengthReturnsFalseIfTagIsNull() {
+               boolean result = ValidationUtils.validateTagLength(null);
+
+               assertFalse(result);
+       }
+
+       @Test
+       public void validateValidateTagListLengthReturnsTrueIfListIsBetweenMaxAndMin() {
+               boolean result = ValidationUtils.validateTagListLength(5);
+
+               assertTrue(result);
+       }
+
+       @Test
+       public void validateValidateTagListLengthReturnsFalseIfListIsToLong() {
+               boolean result = ValidationUtils.validateTagListLength(1250);
+
+               assertFalse(result);
+       }
 
-               // test 1
-               str = "123";
-               result = ValidationUtils.normalizeCategoryName4Display(str);
-               Assert.assertEquals("123", result);
+       @Test
+       public void checkCalidateListNotEmptyReturnsTrueIfListIsNotEmpty() {
+               boolean result = ValidationUtils.validateListNotEmpty(Collections.singletonList("testItem"));
 
-               // test 2
-               str = "123#123";
-               result = ValidationUtils.normalizeCategoryName4Display(str);
-               Assert.assertEquals("123#123", result);
+               assertTrue(result);
        }
 
-       
        @Test
-       public void testNormalizeCategoryName4Uniqueness() throws Exception {
-               String str = "";
-               String result;
+       public void checkCalidateListNotEmptyReturnsFalseIfListIsEmpty() {
+               boolean result = ValidationUtils.validateListNotEmpty(Collections.emptyList());
 
-               // default test
-               result = ValidationUtils.normalizeCategoryName4Uniqueness(str);
+               assertFalse(result);
        }
 
-       
        @Test
-       public void testValidateCategoryDisplayNameLength() throws Exception {
-               String label = "";
-               boolean result;
+       public void checkValidateDescriptionLengthTestReturnsTrueIfTagIsBetweenMaxAndMin() {
+               final String testDescription = "testDescription";
+
+               boolean result = ValidationUtils.validateDescriptionLength(testDescription);
 
-               // default test
-               result = ValidationUtils.validateCategoryDisplayNameLength(label);
+               assertTrue(result);
        }
 
-       
        @Test
-       public void testValidateProductFullNameLength() throws Exception {
-               String fullName = "";
-               boolean result;
+       public void checkValidateDescriptionLengthTestReturnsFalseIfTagIsToLong() {
+               final String testDescription =  generateLongString(1200);
+
+               boolean result = ValidationUtils.validateDescriptionLength(testDescription);
 
-               // default test
-               result = ValidationUtils.validateProductFullNameLength(fullName);
+               assertFalse(result);
        }
 
-       
        @Test
-       public void testValidateArtifactLabelLength() throws Exception {
-               String label = "";
-               boolean result;
+       public void checkValidateVendorNameReturnsTrueIfNameFitsPattern() {
+               final String testVendorName =  "testVendor";
 
-               // default test
-               result = ValidationUtils.validateArtifactLabelLength(label);
+               boolean result = ValidationUtils.validateVendorName(testVendorName);
+
+               assertTrue(result);
        }
 
-       
        @Test
-       public void testValidateResourceInstanceNameLength() throws Exception {
-               String resourceInstanceName = "";
-               boolean result;
+       public void checkValidateVendorNameReturnsFalseIfNameDoesNotFitsPattern() {
+               final String testVendorName =  "test:Vendor";
+
+               boolean result = ValidationUtils.validateVendorName(testVendorName);
 
-               // default test
-               result = ValidationUtils.validateResourceInstanceNameLength(resourceInstanceName);
+               assertFalse(result);
        }
 
-       
        @Test
-       public void testValidateResourceInstanceName() throws Exception {
-               String resourceInstanceName = "";
-               boolean result;
+       public void checkValidateVendorNameLengthReturnsTrueIfNameIsBetweenMaxAndMin() {
+               final String testVendorName =  "testVendor";
+
+               boolean result = ValidationUtils.validateVendorNameLength(testVendorName);
 
-               // default test
-               result = ValidationUtils.validateResourceInstanceName(resourceInstanceName);
+               assertTrue(result);
        }
 
-       
        @Test
-       public void testValidateUrlLength() throws Exception {
-               String url = "";
-               boolean result;
+       public void checkValidateVendorNameLengthReturnsFalseIfNameIsToLong() {
+               final String testVendorName =  generateLongString(90);
 
-               // default test
-               result = ValidationUtils.validateUrlLength(url);
+               boolean result = ValidationUtils.validateVendorNameLength(testVendorName);
+
+               assertFalse(result);
        }
 
-       
        @Test
-       public void testValidateArtifactNameLength() throws Exception {
-               String artifactName = "";
-               boolean result;
+       public void checkValidateResourceVendorModelNumberLengthReturnsTrueIfNameIsBetweenMaxAndMin() {
+               final String testVendorName =  "testVendor";
+
+               boolean result = ValidationUtils.validateResourceVendorModelNumberLength(testVendorName);
 
-               // default test
-               result = ValidationUtils.validateArtifactNameLength(artifactName);
+               assertTrue(result);
        }
 
-       
        @Test
-       public void testValidateComponentNamePattern() throws Exception {
-               String componentName = "";
-               boolean result;
+       public void checkValidateResourceVendorModelNumberLengthReturnsFalseIfNameIsToLong() {
+               final String testVendorName =  generateLongString(90);
+
+               boolean result = ValidationUtils.validateResourceVendorModelNumberLength(testVendorName);
 
-               // default test
-               result = ValidationUtils.validateComponentNamePattern(componentName);
+               assertFalse(result);
        }
 
-       
        @Test
-       public void testValidateComponentNameLength() throws Exception {
-               String componentName = "";
-               boolean result;
+       public void checkValidateVendorReleaseReturnsTrueIfReleaseFitsPattern() {
+               final String testVendorRelease =  "testVendorRelease";
 
-               // default test
-               result = ValidationUtils.validateComponentNameLength(componentName);
+               boolean result = ValidationUtils.validateVendorRelease(testVendorRelease);
+
+               assertTrue(result);
        }
 
-       
        @Test
-       public void testValidateIcon() throws Exception {
-               String icon = "";
-               boolean result;
+       public void checkValidateVendorReleaseReturnsFalseIfReleaseDoesNotFitsPattern() {
+               final String testVendorRelease =  "testVendor:Release";
+
+               boolean result = ValidationUtils.validateVendorRelease(testVendorRelease);
 
-               // default test
-               result = ValidationUtils.validateIcon(icon);
+               assertFalse(result);
        }
 
-       
        @Test
-       public void testValidateIconLength() throws Exception {
-               String icon = "";
-               boolean result;
+       public void checkValidateVendorReleaseLengthReturnsTrueIfReleaseIsBetweenMaxAndMin() {
+               final String testVendorRelease =  "testVendorRelease";
 
-               // default test
-               result = ValidationUtils.validateIconLength(icon);
+               boolean result = ValidationUtils.validateVendorReleaseLength(testVendorRelease);
+
+               assertTrue(result);
        }
 
-       
        @Test
-       public void testValidateProjectCode() throws Exception {
-               String projectCode = "";
-               boolean result;
+       public void checkValidateVendorReleaseLengthReturnsFalseIfReleaseIsToLong() {
+               final String testVendorRelease =  generateLongString(30);
+
+               boolean result = ValidationUtils.validateVendorReleaseLength(testVendorRelease);
 
-               // default test
-               result = ValidationUtils.validateProjectCode(projectCode);
+               assertFalse(result);
        }
 
-       
        @Test
-       public void testValidateProjectCodeLegth() throws Exception {
-               String projectCode = "";
-               boolean result;
+       public void checkValidateServiceTypeLengthReturnsTrueIfReleaseIsBetweenMaxAndMin() {
+               final String testServiceType =  "testServiceType";
+
+               boolean result = ValidationUtils.validateServiceTypeLength(testServiceType);
 
-               // default test
-               result = ValidationUtils.validateProjectCodeLegth(projectCode);
+               assertTrue(result);
        }
 
-       
        @Test
-       public void testValidateContactId() throws Exception {
-               String contactId = "";
-               boolean result;
+       public void checkValidateServiceTypeLengthReturnsFalseIfReleaseIsToLong() {
+               final String testServiceType =  generateLongString(500);
 
-               // default test
-               result = ValidationUtils.validateContactId(contactId);
+               boolean result = ValidationUtils.validateServiceTypeLength(testServiceType);
+
+               assertFalse(result);
        }
 
-       
        @Test
-       public void testValidateCost() throws Exception {
-               String cost = "";
-               boolean result;
+       public void checkValidateServiceRoleLengthReturnsTrueIfReleaseIsBetweenMaxAndMin() {
+               final String testServiceRoleLength =  "testServiceType";
+
+               boolean result = ValidationUtils.validateServiceRoleLength(testServiceRoleLength);
 
-               // default test
-               result = ValidationUtils.validateCost(cost);
+               assertTrue(result);
        }
 
-       
        @Test
-       public void testRemoveHtmlTags() throws Exception {
-               String str = "";
-               String result;
+       public void checkValidateServiceRoleLengthReturnsFalseIfReleaseIsToLong() {
+               final String testServiceRoleLength =  generateLongString(500);
 
-               // default test
-               result = ValidationUtils.removeHtmlTags(str);
+               boolean result = ValidationUtils.validateServiceRoleLength(testServiceRoleLength);
+
+               assertFalse(result);
        }
 
-       
        @Test
-       public void testRemoveAllTags() throws Exception {
-               String htmlText = "";
-               String result;
+       public void validateHasBeenCertifiedReturnsTrueIfVersionIsEqualOrBiggerThan1() {
+               final String testVersion = "1.0";
+
+               boolean result = ValidationUtils.hasBeenCertified(testVersion);
 
-               // default test
-               result = ValidationUtils.removeAllTags(htmlText);
+               assertTrue(result);
        }
 
-       
        @Test
-       public void testNormaliseWhitespace() throws Exception {
-               String str = "";
-               String result;
+       public void validateHasBeenCertifiedReturnsFalseIfVersionIsSmallerThan1() {
+               final String testVersion = "0.6";
+
+               boolean result = ValidationUtils.hasBeenCertified(testVersion);
 
-               // default test
-               result = ValidationUtils.normaliseWhitespace(str);
+               assertFalse(result);
        }
 
-       
        @Test
-       public void testStripOctets() throws Exception {
-               String str = "";
-               String result;
+       public void validateNormaliseComponentNameReturnsNormalizedName() {
+               final String testName = "test-Component-Service";
 
-               // default test
-               result = ValidationUtils.stripOctets(str);
+               String result = ValidationUtils.normaliseComponentName(testName);
+
+               assertEquals(result, "testcomponentservice");
        }
 
-       
        @Test
-       public void testRemoveNoneUtf8Chars() throws Exception {
-               String input = "";
-               String result;
+       public void validateNormaliseComponentInstanceNameReturnsNormalizedName() {
+               final String testName = "test-Component-Service";
+
+               String result = ValidationUtils.normalizeComponentInstanceName(testName);
 
-               // default test
-               result = ValidationUtils.removeNoneUtf8Chars(input);
+               assertEquals(result, "testcomponentservice");
        }
 
-       
        @Test
-       public void testValidateIsEnglish() throws Exception {
-               String input = "";
-               boolean result;
+       public void validateConvertToSystemNameReturnsProperSystemName() {
+               final String testName = "test-Component-Service";
 
-               // default test
-               result = ValidationUtils.validateIsEnglish(input);
+               String result = ValidationUtils.convertToSystemName(testName);
+
+               assertEquals(result, "TestComponentService");
        }
 
-       
        @Test
-       public void testValidateIsAscii() throws Exception {
-               String input = "";
-               boolean result;
+       public void validateNormalizeFileNameReturnsNormalizedName() {
+               final String testName = "test File Name";
+
+               String result = ValidationUtils.normalizeFileName(testName);
 
-               // default test
-               result = ValidationUtils.validateIsAscii(input);
+               assertEquals(result, "test-File-Name");
        }
 
-       
        @Test
-       public void testConvertHtmlTagsToEntities() throws Exception {
-               String input = "";
-               String result;
+       public void validateNormalizeFileNameFor3gppYangModule() {
+           final String testName = "_3gpptestfile";
+
+           String result = ValidationUtils.normalizeFileName(testName);
 
-               // default test
-               result = ValidationUtils.convertHtmlTagsToEntities(input);
+           assertEquals(result, testName);
        }
 
-       
+       @Test
+       public void validateNormalizeFileNameStripLeadingUnderscore() {
+           final String testName = "_testfile";
+
+           String result = ValidationUtils.normalizeFileName(testName);
 
+           assertEquals(result, "testfile");
+       }
 
-       
+       @Test
+       public void checkValidateUrlReturnsTrueIfURLIsValid() {
+               final String testUrl = "http://test.co/valid/url/";
 
+               boolean result = ValidationUtils.validateUrl(testUrl);
+
+               assertTrue(result);
+       }
 
-       
        @Test
-       public void testValidateTagListLength() throws Exception {
-               int tagListLength = 0;
-               boolean result;
+       public void checkValidateUrlReturnsFalseIfURLIsNotValid() {
+               final String testUrl = "http//notvalid!#url";
+
+               boolean result = ValidationUtils.validateUrl(testUrl);
 
-               // default test
-               result = ValidationUtils.validateTagListLength(tagListLength);
+               assertFalse(result);
        }
 
-       
        @Test
-       public void testValidateDescriptionLength() throws Exception {
-               String description = "";
-               boolean result;
+       public void checkValidateUrlReturnsFalseIfURLIsNotUtf8() {
+               final String testUrl = "http://test.co/notutf/קקurl/";
 
-               // default test
-               result = ValidationUtils.validateDescriptionLength(description);
+               boolean result = ValidationUtils.validateUrl(testUrl);
+
+               assertFalse(result);
        }
 
-       
        @Test
-       public void testValidateStringNotEmpty() throws Exception {
-               String value = "";
-               boolean result;
+       public void validateNormalizeArtifactLabelReturnsNormalizeArtifactLabel() {
+               final String testArtifactLabel = "test-File-Name";
 
-               // test 1
-               value = null;
-               result = ValidationUtils.validateStringNotEmpty(value);
-               Assert.assertEquals(false, result);
+               String result = ValidationUtils.normalizeArtifactLabel(testArtifactLabel);
 
-               // test 2
-               value = "";
-               result = ValidationUtils.validateStringNotEmpty(value);
-               Assert.assertEquals(false, result);
+               assertEquals(result, "testfilename");
        }
 
-       
        @Test
-       public void testValidateListNotEmpty() throws Exception {
-               List<?> list = null;
-               boolean result;
+       public void validateAdditionalInformationKeyNameReturnsTrueIfAdditionalInformationAreValid() {
+               final String testAdditionalInformationKeyName = "KeyName";
+
+               boolean result = ValidationUtils.validateAdditionalInformationKeyName(testAdditionalInformationKeyName);
 
-               // test 1
-               list = null;
-               result = ValidationUtils.validateListNotEmpty(list);
-               Assert.assertEquals(false, result);
+               assertTrue(result);
        }
 
-       
        @Test
-       public void testValidateVendorName() throws Exception {
-               String vendorName = "";
-               boolean result;
+       public void validateNormalizeAdditionalInformationReturnsNormalizeArtifactLabel() {
+               final String testArtifactLabel = "additional--Information__Testing";
+
+               String result = ValidationUtils.normalizeAdditionalInformation(testArtifactLabel);
 
-               // default test
-               result = ValidationUtils.validateVendorName(vendorName);
+               assertEquals(result, "additional-Information_Testing");
        }
 
-       
        @Test
-       public void testValidateVendorNameLength() throws Exception {
-               String vendorName = "";
-               boolean result;
+       public void checkValidateLengthReturnsTrueIfStringIsShorterThenGivenLength() {
+               final String testString = "testString";
 
-               // default test
-               result = ValidationUtils.validateVendorNameLength(vendorName);
+               boolean result = ValidationUtils.validateLength(testString,50);
+
+               assertTrue(result);
        }
 
-       
        @Test
-       public void testValidateResourceVendorModelNumberLength() throws Exception {
-               String resourceVendorModelNumber = "";
-               boolean result;
+       public void checkValidateLengthReturnsTrueIfStringIsNull() {
+               boolean result = ValidationUtils.validateLength(null,50);
 
-               // default test
-               result = ValidationUtils.validateResourceVendorModelNumberLength(resourceVendorModelNumber);
+               assertTrue(result);
        }
 
-       
        @Test
-       public void testValidateVendorRelease() throws Exception {
-               String vendorRelease = "";
-               boolean result;
+       public void checkValidateLengthReturnsTrueIfStringIsExitsTheGivenLength() {
+               final String testString = "testString";
+
+               boolean result = ValidationUtils.validateLength(testString,5);
 
-               // default test
-               result = ValidationUtils.validateVendorRelease(vendorRelease);
+               assertFalse(result);
        }
 
-       
        @Test
-       public void testValidateVendorReleaseLength() throws Exception {
-               String vendorRelease = "";
-               boolean result;
+       public void validateIsUTF8StrReturnsFalseIfGivenStringContainsUtf8Character(){
+final String testString="testקString";
 
-               // default test
-               result = ValidationUtils.validateVendorReleaseLength(vendorRelease);
+               boolean result=ValidationUtils.isUTF8Str(testString);
+
+               assertFalse(result);
        }
 
-       
        @Test
-       public void testValidateServiceTypeLength() throws Exception {
-               String serviceType = "";
-               boolean result;
+       public void validateIsUTF8StrReturnsTrueIfGivenStringDoesNotContainsUtf8Character() {
+               final String testString = "testString";
+
+               boolean result = ValidationUtils.isUTF8Str(testString);
 
-               // default test
-               result = ValidationUtils.validateServiceTypeLength(serviceType);
+               assertTrue(result);
        }
 
-       
        @Test
-       public void testValidateServiceRoleLength() throws Exception {
-               String serviceRole = "";
-               boolean result;
+       public void validateIsFloatNumberReturnsTrueIfGivenStringRepresentsFloatNumber() {
+               final String testString = "12.45";
+
+               boolean result = ValidationUtils.isFloatNumber(testString);
 
-               // default test
-               result = ValidationUtils.validateServiceRoleLength(serviceRole);
+               assertTrue(result);
        }
 
-       
        @Test
-       public void testHasBeenCertified() throws Exception {
-               String version = "";
-               boolean result;
+       public void validateIsFloatNumberReturnsFalseIfGivenStringDoesNotRepresentsFloatNumber() {
+               final String testString = "notFloatingPoint";
 
-               // default test
-               result = ValidationUtils.hasBeenCertified(version);
+               boolean result = ValidationUtils.isFloatNumber(testString);
+
+               assertFalse(result);
        }
 
-       
        @Test
-       public void testNormaliseComponentName() throws Exception {
-               String name = "";
-               String result;
+       public void validateCertifiedVersionReturnsTrueIfGivenStringRepresentsVersion() {
+               final String testString = "1.0";
+
+               boolean result = ValidationUtils.validateCertifiedVersion(testString);
 
-               // default test
-               result = ValidationUtils.normaliseComponentName(name);
+               assertTrue(result);
        }
 
-       
        @Test
-       public void testNormalizeComponentInstanceName() throws Exception {
-               String name = "";
-               String result;
+       public void validateCertifiedVersionReturnsFalseIfGivenStringDoesNotRepresentsVersion() {
+               final String testString = "notVersion";
 
-               // default test
-               result = ValidationUtils.normalizeComponentInstanceName(name);
+               boolean result = ValidationUtils.validateCertifiedVersion(testString);
+
+               assertFalse(result);
        }
 
-       
+       @Test
+       public void validateMinorVersionReturnsTrueIfGivenStringRepresentsMinorVersion() {
+               final String testString = "0.1";
+
+               boolean result = ValidationUtils.validateMinorVersion(testString);
 
+               assertTrue(result);
+       }
 
-       
        @Test
-       public void testConvertToSystemName() throws Exception {
-               String name = "";
-               String result;
+       public void validateMinorVersionReturnsFalseIfGivenStringDoesNotRepresentsMinorVersion() {
+               final String testString = "notMinorVersion";
+
+               boolean result = ValidationUtils.validateMinorVersion(testString);
 
-               // default test
-               result = ValidationUtils.convertToSystemName(name);
+               assertFalse(result);
        }
 
-       
        @Test
-       public void testNormalizeFileName() throws Exception {
-               String filename = "";
-               String result;
+       public void validateCleanArtifactDisplayNameReturnsCleanedArtifactName() {
+               final String testArtifactDisplayName = "  test-File   Name";
+
+               String result = ValidationUtils.cleanArtifactDisplayName(testArtifactDisplayName);
 
-               // default test
-               result = ValidationUtils.normalizeFileName(filename);
+               assertEquals(result, "test-File Name");
        }
 
-       
+       @Test
+       public void checkValidateArtifactLabelReturnsTrueIfLabelIsValid() {
+               final String testArtifactDisplayName = "testLabel";
+
+               boolean result = ValidationUtils.validateArtifactLabel(testArtifactDisplayName);
 
+               assertTrue(result);
+       }
 
-       
        @Test
-       public void testValidateUrl() throws Exception {
-               String url = "";
-               boolean result;
+       public void checkValidateArtifactLabelReturnsFalseIfLabelIsNotValid(){
+final String testArtifactDisplayName="test=notValid=Label";
 
-               // default test
-               result = ValidationUtils.validateUrl(url);
+               boolean result=ValidationUtils.validateArtifactLabel(testArtifactDisplayName);
+
+               assertFalse(result);
        }
 
-       
        @Test
-       public void testCleanArtifactDisplayName() throws Exception {
-               String strIn = "";
-               String result;
+       public void checkValidateArtifactLabelReturnsTrueWithAtSymbol() {
+               assertTrue(ValidationUtils.validateArtifactLabel("test@label"));
+       }
 
-               // default test
-               result = ValidationUtils.cleanArtifactDisplayName(strIn);
+       @Test
+       public void checkValidateConsumerNameReturnsTrueIfLabelIsValid() {
+               final String testConsumerName = "testConsumerName";
+
+               boolean result = ValidationUtils.validateConsumerName(testConsumerName);
+
+               assertTrue(result);
        }
 
-       
        @Test
-       public void testNormalizeArtifactLabel() throws Exception {
-               String strIn = "";
-               String result;
+       public void checkValidateConsumerNameReturnsFalseIfLabelIsNotValid(){
+final String testConsumerName="test=notValid=ConsumerName";
+
+               boolean result=ValidationUtils.validateConsumerName(testConsumerName);
+
+               assertFalse(result);
+               }
+
+       @Test
+       public void checkValidateConsumerPassSaltReturnsTrueIfLabelIsValid() {
+               final String testPassSalt = "123qwe";
+
+               boolean result = ValidationUtils.validateConsumerPassSalt(testPassSalt);
 
-               // default test
-               result = ValidationUtils.normalizeArtifactLabel(strIn);
+               assertTrue(result);
        }
 
-       
        @Test
-       public void testValidateAdditionalInformationKeyName() throws Exception {
-               String str = "";
-               boolean result;
+       public void checkValidateConsumerPassSaltReturnsFalseIfLabelIsNotValid() {
+               final String testPassSalt = "_123qweLO";
 
-               // default test
-               result = ValidationUtils.validateAdditionalInformationKeyName(str);
+               boolean result = ValidationUtils.validateConsumerPassSalt(testPassSalt);
+
+               assertFalse(result);
        }
 
-       
+       @Test
+       public void checkValidateCategoryNameFormatReturnsTrueIfLabelIsValid() {
+               final String testDisplayNameFormat = "DisplayNameFormat";
 
+               boolean result = ValidationUtils.validateCategoryDisplayNameFormat(testDisplayNameFormat);
 
-       
+               assertTrue(result);
+       }
+
+       @Test
+       public void checkValidateCategoryNameFormatReturnsFalseIfLabelIsNotValid() {
+               final String testDisplayNameFormat = "Display{NotValid}NameFormat";
 
+               boolean result = ValidationUtils.validateCategoryDisplayNameFormat(testDisplayNameFormat);
+
+               assertFalse(result);
+       }
 
-       
        @Test
-       public void testValidateConsumerName() throws Exception {
-               String consumerName = "";
-               boolean result;
+       public void checkValidateCategoryNameFormatReturnsFalseIfLabelIsStartingWihNonAlphabetical() {
+               final String testDisplayNameFormat = "@DisplayNameFormat";
 
-               // default test
-               result = ValidationUtils.validateConsumerName(consumerName);
+               boolean result = ValidationUtils.validateCategoryDisplayNameFormat(testDisplayNameFormat);
+
+               assertFalse(result);
        }
 
-       
        @Test
-       public void testIsUTF8Str() throws Exception {
-               String str = "";
-               boolean result;
+       public void checkValidateCategoryNameLengthReturnsTrueIfLabelLengthIsBetweenMinaAndMax() {
+               final String testDisplayNameFormat = "DisplayNameFormat";
+
+               boolean result = ValidationUtils.validateCategoryDisplayNameLength(testDisplayNameFormat);
 
-               // default test
-               result = ValidationUtils.isUTF8Str(str);
+               assertTrue(result);
        }
 
-       
        @Test
-       public void testValidateConsumerPassSalt() throws Exception {
-               String consumerSalt = "";
-               boolean result;
+       public void checkValidateCategoryNameLengthReturnsFalseIfLabelLengthIsToLong() {
+               final String testDisplayNameFormat = generateLongString(28);
+
+               boolean result = ValidationUtils.validateCategoryDisplayNameLength(testDisplayNameFormat);
 
-               // default test
-               result = ValidationUtils.validateConsumerPassSalt(consumerSalt);
+               assertFalse(result);
        }
 
-       
        @Test
-       public void testIsFloatNumber() throws Exception {
-               String number = "";
-               boolean result;
+       public void validateNormalizeCategoryNameReturnsNormalizeName() {
+               final String testCatalogName = "not Normalize OF CatalogName";
 
-               // default test
-               result = ValidationUtils.isFloatNumber(number);
+               String result = ValidationUtils.normalizeCategoryName4Display(testCatalogName);
+
+               assertEquals(result, "Not Normalize of CatalogName");
        }
 
-       
        @Test
-       public void testValidateCertifiedVersion() throws Exception {
-               String version = "";
-               boolean result;
+       public void validateNormalizeCategoryLabelReturnsNormalizeLabel() {
+               final String testCatalogLabel = "not Normalize OF CatalogLabel";
+
+               String result = ValidationUtils.normalizeCategoryName4Uniqueness(testCatalogLabel);
 
-               // default test
-               result = ValidationUtils.validateCertifiedVersion(version);
+               assertEquals(result, "not normalize of cataloglabel");
        }
 
-       
        @Test
-       public void testValidateMinorVersion() throws Exception {
-               String version = "";
-               boolean result;
+       public void validateNormaliseProductNameReturnsNormalizedName() {
+               final String testProductName = "Product Name";
+
+               String result = ValidationUtils.normaliseProductName(testProductName);
+
+               assertEquals(result, "productname");
 
-               // default test
-               result = ValidationUtils.validateMinorVersion(version);
        }
 
-       
        @Test
-       public void testNormaliseProductName() throws Exception {
-               String name = "";
-               String result;
+       public void validateRemoveHtmlTagsOnlyReturnsStringWithRemovedHtmlTags() {
+               final String testHtml = "<div>Product <p>Name</p> <not html tag></div>";
+
+               String result = ValidationUtils.removeHtmlTagsOnly(testHtml);
+
+               assertEquals(result, "Product Name <not html tag>");
 
-               // default test
-               result = ValidationUtils.normaliseProductName(name);
        }
 
-       
+       @Test
+       public void checkValidateForwardingPathNamePatternReturnsTrueIfPathIsValid() {
+               final String testForwardingPath = "test.forwarding.path";
+
+               boolean result = ValidationUtils.validateForwardingPathNamePattern(testForwardingPath);
 
+               assertTrue(result);
+       }
 
-       
        @Test
-       public void testRemoveHtmlTagsOnly() throws Exception {
-               String htmlText = "";
-               String result;
+       public void checkValidateForwardingPathNamePatternReturnsFalseIfPathIsNotValid() {
+               final String testForwardingPath = "test/notValid/forwarding//path";
+
+               boolean result = ValidationUtils.validateForwardingPathNamePattern(testForwardingPath);
+
+               assertFalse(result);
+       }
 
-               // default test
-               result = ValidationUtils.removeHtmlTagsOnly(htmlText);
+       private String generateLongString(int length) {
+               StringBuilder toLongLabelBuilder = new StringBuilder();
+               for(int i=0 ; i<=length ; i++) {
+                       toLongLabelBuilder.append("t");
+               }
+               return toLongLabelBuilder.toString();
        }
-}
\ No newline at end of file
+}