Dont filter get_vnf_data_by_globalid_and_service_type_response results
[vid.git] / vid-app-common / src / test / java / org / onap / vid / services / CategoryParameterServiceImplTest.java
index 7a4263c..790427a 100644 (file)
@@ -2,15 +2,15 @@
  * ============LICENSE_START=======================================================
  * VID
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2018 Nokia. All rights reserved.
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2018 - 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.
@@ -95,7 +95,8 @@ public class CategoryParameterServiceImplTest {
         AddCategoryOptionsRequest optionsRequest = new AddCategoryOptionsRequest();
         optionsRequest.options.add(OPTION_NAME);
         CategoryParameter categoryParameter = createCategoryParameter(CATEGORY_NAME, true);
-        categoryParameter.getOptions().add(new CategoryParameterOption(APP_ID_VID, OPTION_NAME, categoryParameter));
+        CategoryParameter anotherCategoryParameter = createCategoryParameter(CATEGORY_NAME, true);
+        categoryParameter.addOption(new CategoryParameterOption(APP_ID_VID, OPTION_NAME, anotherCategoryParameter));
         List<CategoryParameter> aList = createCategoryParametersList(categoryParameter);
 
         String expectedError = String.format(CategoryParameterServiceImpl.OPTION_ALREADY_EXIST_FOR_CATEGORY
@@ -155,9 +156,10 @@ public class CategoryParameterServiceImplTest {
     @Test
     public void deleteCategoryOption_happyPath() {
         CategoryParameter categoryParameter = createCategoryParameter(CATEGORY_NAME, true);
+        CategoryParameter anotherCategoryParameter = createCategoryParameter(CATEGORY_NAME, true);
         CategoryParameterOption categoryParameterOption =
-            new CategoryParameterOption(APP_ID_VID, OPTION_NAME, categoryParameter);
-        categoryParameter.getOptions().add(categoryParameterOption);
+            new CategoryParameterOption(APP_ID_VID, OPTION_NAME, anotherCategoryParameter);
+        categoryParameter.addOption(categoryParameterOption);
         List<CategoryParameter> aList = createCategoryParametersList(categoryParameter);
 
         doReturn(aList).when(dataAccessService).getList(any(), anyString(), any(), any());
@@ -171,9 +173,10 @@ public class CategoryParameterServiceImplTest {
     @Test
     public void getCategoryParametersTest() {
         CategoryParameter categoryParameter = createCategoryParameter(CATEGORY_NAME, true);
+        CategoryParameter anotherCategoryParameter = createCategoryParameter(CATEGORY_NAME, true);
         CategoryParameterOption categoryParameterOption =
-            new CategoryParameterOption(APP_ID_VID, OPTION_NAME, categoryParameter);
-        categoryParameter.getOptions().add(categoryParameterOption);
+            new CategoryParameterOption(APP_ID_VID, OPTION_NAME, anotherCategoryParameter);
+        categoryParameter.addOption(categoryParameterOption);
         List<CategoryParameter> aList = createCategoryParametersList(categoryParameter);
 
         doReturn(aList).when(dataAccessService).getList(any(), anyString(), any(), any());
@@ -191,8 +194,9 @@ public class CategoryParameterServiceImplTest {
     public void updateCategoryParameterOption_domainObjectGetsSavedSuccessfully() {
         CategoryParameterOptionRep optionRepExisting = new CategoryParameterOptionRep(APP_ID_VID, OPTION_NAME);
         CategoryParameter categoryParameter = createCategoryParameter(CATEGORY_NAME, true);
-        categoryParameter.getOptions().add(
-            new CategoryParameterOption(APP_ID_VID, UNIQUE_OPTION_NAME, categoryParameter));
+        CategoryParameter anotherCategoryParameter = createCategoryParameter(CATEGORY_NAME, true);
+        categoryParameter.addOption(
+            new CategoryParameterOption(APP_ID_VID, UNIQUE_OPTION_NAME, anotherCategoryParameter));
         List<CategoryParameter> aList = createCategoryParametersList(categoryParameter);
 
         doReturn(aList).when(dataAccessService).getList(CategoryParameter.class, QUERY_STRING_FOR_CATEGORY_NAME, null, null);
@@ -207,7 +211,8 @@ public class CategoryParameterServiceImplTest {
     public void updateCategoryParameterOption_shouldFailUpdateForbidden() {
         CategoryParameterOptionRep optionRep = new CategoryParameterOptionRep("1", CATEGORY_NAME);
         CategoryParameter categoryParameter = createCategoryParameter(CATEGORY_NAME, false);
-        categoryParameter.getOptions().add(new CategoryParameterOption(APP_ID_VID, OPTION_NAME, categoryParameter));
+        CategoryParameter anotherCategoryParameter = createCategoryParameter(CATEGORY_NAME, false);
+        categoryParameter.addOption(new CategoryParameterOption(APP_ID_VID, OPTION_NAME, anotherCategoryParameter));
         List<CategoryParameter> aList = createCategoryParametersList(categoryParameter);
 
         doReturn(aList).when(dataAccessService).getList(CategoryParameter.class, QUERY_STRING_FOR_CATEGORY_NAME, null, null);
@@ -222,7 +227,8 @@ public class CategoryParameterServiceImplTest {
         CategoryParameterOptionRep optionRep = new CategoryParameterOptionRep("SOME_UNRELATED_ID", CATEGORY_NAME);
 
         CategoryParameter categoryParameter = createCategoryParameter(CATEGORY_NAME, true);
-        categoryParameter.getOptions().add(new CategoryParameterOption(APP_ID_VID, OPTION_NAME, categoryParameter));
+        CategoryParameter anotherCategoryParameter = createCategoryParameter(CATEGORY_NAME, true);
+        categoryParameter.addOption(new CategoryParameterOption(APP_ID_VID, OPTION_NAME, anotherCategoryParameter));
         List<CategoryParameter> aList = createCategoryParametersList(categoryParameter);
 
         doReturn(aList).when(dataAccessService).getList(CategoryParameter.class, QUERY_STRING_FOR_CATEGORY_NAME, null, null);
@@ -238,9 +244,9 @@ public class CategoryParameterServiceImplTest {
 
         CategoryParameter categoryParameter = createCategoryParameter(CATEGORY_NAME, true);
         CategoryParameter anotherCategoryParameter = createCategoryParameter(CATEGORY_NAME, true);
-        categoryParameter.getOptions().add(
+        categoryParameter.addOption(
             new CategoryParameterOption(APP_ID_VID, UNIQUE_OPTION_NAME, anotherCategoryParameter));
-        categoryParameter.getOptions().add(
+        categoryParameter.addOption(
             new CategoryParameterOption(APP_ID_SDC, OPTION_NAME, anotherCategoryParameter));
         List<CategoryParameter> aList = createCategoryParametersList(categoryParameter);
 
@@ -257,4 +263,4 @@ public class CategoryParameterServiceImplTest {
         categoryParameter.setIdSupported(idSupported);
         return categoryParameter;
     }
-}
\ No newline at end of file
+}