Fix minor checksyle issues in models
[policy/models.git] / models-interactions / model-actors / actor.appclcm / src / test / java / org / onap / policy / controlloop / actor / appclcm / AppcLcmRecipeFormatterTest.java
1 /*
2  * ============LICENSE_START=======================================================
3  *
4  * ================================================================================
5  * Copyright (C) 2018 Nokia Intellectual Property. All rights reserved.
6  * Modifications Copyright (C) 2019 Nordix Foundation.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.policy.controlloop.actor.appclcm;
23
24 import static org.junit.Assert.assertEquals;
25
26 import org.junit.Test;
27
28 public class AppcLcmRecipeFormatterTest {
29
30     @Test
31     public void testShouldCorrectlyFormatRestartRequestWhenRestartGiven() {
32         // given
33         AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("Restart");
34         String expectedUrlRecipe = "restart";
35         String expectedBodyRecipe = "Restart";
36
37         // when
38         String actualUrlRecipe = recipeFormatter.getUrlRecipe();
39         String actualBodyRecipe = recipeFormatter.getBodyRecipe();
40
41         // then
42         assertEquals(expectedUrlRecipe, actualUrlRecipe);
43         assertEquals(expectedBodyRecipe, actualBodyRecipe);
44     }
45
46     @Test
47     public void testShouldReturnCapitalizedBodySingleWordRecipe() {
48         // given
49         AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("moDify");
50         String expectedRecipe = "Modify";
51
52         // when
53         String actualRecipe = recipeFormatter.getBodyRecipe();
54
55         // then
56         assertEquals(expectedRecipe, actualRecipe);
57     }
58
59     @Test
60     public void testShouldReturnCapitalizeAndJoinedBodyMultiWordRecipe() {
61         // given
62         AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("coNfig-moDify");
63         String expectedRecipe = "ConfigModify";
64
65         // when
66         String actualRecipe = recipeFormatter.getBodyRecipe();
67
68         // then
69         assertEquals(expectedRecipe, actualRecipe);
70     }
71
72     @Test
73     public void testShouldReturnLowercasedUrlSingleWordRecipe() {
74         // given
75         AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("ModIfy");
76         String expectedRecipe = "modify";
77
78         // when
79         String actualRecipe = recipeFormatter.getUrlRecipe();
80
81         // then
82         assertEquals(expectedRecipe, actualRecipe);
83     }
84
85     @Test
86     public void testShouldReturnLowercasedDashJoinedUrlMultiWordRecipe() {
87         // given
88         AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("Config-MoDify");
89         String expectedRecipe = "config-modify";
90
91         // when
92         String actualRecipe = recipeFormatter.getUrlRecipe();
93
94         // then
95         assertEquals(expectedRecipe, actualRecipe);
96     }
97 }