3dc5299c9b199f2e76124aa659af84d72f81f613
[aai/traversal.git] / aai-traversal / src / test / java / org / openecomp / aai / transforms / LowerHyphenToLowerCamelConverterTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * org.openecomp.aai
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.aai.transforms;
22
23 import org.junit.Test;
24 import org.junit.runner.RunWith;
25 import org.junit.runners.Parameterized;
26 import org.junit.runners.Parameterized.Parameters;
27
28 import java.util.Arrays;
29 import java.util.Collection;
30
31 import static org.junit.Assert.*;
32
33 @RunWith(Parameterized.class)
34 public class LowerHyphenToLowerCamelConverterTest {
35
36     private Converter converter = new LowerHyphenToLowerCamelConverter();
37
38     private String input;
39     private String expected;
40
41     public LowerHyphenToLowerCamelConverterTest(String input, String expected){
42         this.input  = input;
43         this.expected = expected;
44     }
45
46     /**
47      * Data Provider for the Lower Hyphen to Camel Converter Tests
48      * Make sure the capitalization is not lost during the conversion
49      * @return
50      */
51     @Parameters
52     public static Collection<Object[]> data(){
53
54         return Arrays.asList(new Object[][]{
55             {null, null},
56             {"test-name", "testName"},
57             {"test---name", "testName"},            // Case multiple
58             {"testName", "testName"},               // Case where upper case word shouldn't be lowercased
59             {"test-name-cool", "testNameCool"},
60             {"test-name-Cool", "testNameCool"},
61             {"test-name-Cool-Name-wow----Rest", "testNameCoolNameWowRest"},
62             {"test-name#fast#", "testName#fast#"},
63             {"test-name---", "testName"},
64             {"----test-name", "TestName"},
65         });
66     }
67
68     @Test
69     public void testIfInputSuccessfullyModified(){
70         String actual = converter.convert(input);
71         assertEquals(expected, actual);
72     }
73 }