diff options
Diffstat (limited to 'models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java')
-rw-r--r-- | models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java new file mode 100644 index 000000000..8e9a4c30c --- /dev/null +++ b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java @@ -0,0 +1,99 @@ +/* + * ============LICENSE_START======================================================= + * + * ================================================================================ + * Copyright (C) 2018 Nokia Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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========================================================= + */ + +package org.onap.policy.controlloop.actor.appclcm; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + + + +public class AppcLcmRecipeFormatterTest { + + @Test + public void shouldCorrectlyFormatRestartRequestWhenRestartGiven() { + //given + AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("Restart"); + String expectedUrlRecipe = "restart"; + String expectedBodyRecipe = "Restart"; + + //when + String actualUrlRecipe = recipeFormatter.getUrlRecipe(); + String actualBodyRecipe = recipeFormatter.getBodyRecipe(); + + //then + assertEquals(expectedUrlRecipe, actualUrlRecipe); + assertEquals(expectedBodyRecipe, actualBodyRecipe); + } + + @Test + public void shouldReturnCapitalizedBodySingleWordRecipe() { + //given + AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("moDify"); + String expectedRecipe = "Modify"; + + //when + String actualRecipe = recipeFormatter.getBodyRecipe(); + + //then + assertEquals(expectedRecipe, actualRecipe); + } + + @Test + public void shouldReturnCapitalizeAndJoinedBodyMultiWordRecipe() { + //given + AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("coNfig-moDify"); + String expectedRecipe = "ConfigModify"; + + //when + String actualRecipe = recipeFormatter.getBodyRecipe(); + + //then + assertEquals(expectedRecipe, actualRecipe); + } + + @Test + public void shouldReturnLowercasedUrlSingleWordRecipe() { + //given + AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("ModIfy"); + String expectedRecipe = "modify"; + + //when + String actualRecipe = recipeFormatter.getUrlRecipe(); + + //then + assertEquals(expectedRecipe, actualRecipe); + } + + @Test + public void shouldReturnLowercasedDashJoinedUrlMultiWordRecipe() { + //given + AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("Config-MoDify"); + String expectedRecipe = "config-modify"; + + //when + String actualRecipe = recipeFormatter.getUrlRecipe(); + + //then + assertEquals(expectedRecipe, actualRecipe); + } +}
\ No newline at end of file |