diff options
Diffstat (limited to 'vid-app-common/src/test')
-rw-r--r-- | vid-app-common/src/test/java/org/onap/vid/services/CategoryParameterServiceImplTest.java | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/CategoryParameterServiceImplTest.java b/vid-app-common/src/test/java/org/onap/vid/services/CategoryParameterServiceImplTest.java index 7a4263c7e..3492a7547 100644 --- a/vid-app-common/src/test/java/org/onap/vid/services/CategoryParameterServiceImplTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/services/CategoryParameterServiceImplTest.java @@ -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); |