More license header changes to appc-client files
[appc.git] / appc-client / code-generator / src / test / java / org / onap / appc / tools / generator / api / CLITest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
4  * ================================================================================
5  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Copyright (C) 2017 Amdocs
8  * =============================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  * 
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  * 
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * 
21  * ============LICENSE_END=========================================================
22  */
23
24 package org.onap.appc.tools.generator.api;
25
26 import org.junit.Assert;
27 import org.junit.Test;
28
29 public class CLITest {
30     @Test
31     public void missingSourceFileTest()  {
32         CLI cli = new CLI();
33         try {
34             String[] input = new String[1];
35             cli.main(input);
36         } catch (Exception e) {
37             Assert.assertEquals("Source file is missing. Please add argument 'client <source file> <destination file> <model template>'",e.getMessage());
38         }
39     }
40     @Test
41     public void missingDestinationFileTest()  {
42         CLI cli = new CLI();
43         try {
44             String[] input = {"sourceFilePath",null};
45             cli.main(input);
46         } catch (Exception e) {
47             Assert.assertEquals("Destination file name is missing. Please add argument 'client sourceFilePath <destination> <model template> <builder> <conf file>'",e.getMessage());
48         }
49     }
50     @Test
51     public void missingTemplateFileTest()  {
52         CLI cli = new CLI();
53         try {
54             String[] input = {"sourceFilePath","destinationPath",null};
55             cli.main(input);
56         } catch (Exception e) {
57             Assert.assertEquals("template file name is missing. Please add argument 'client sourceFilePath destinationPath <model template> <builder> <conf file>'",e.getMessage());
58         }
59     }
60     @Test
61     public void missingBuilderNameTest()  {
62         CLI cli = new CLI();
63         try {
64             String[] input = {"sourceFilePath","destinationPath","templateFileName",null};
65             cli.main(input);
66         } catch (Exception e) {
67             Assert.assertEquals("builder FQDN is missing. Please add argument 'client sourceFilePath destinationPath templateFileName <builder> <conf file>'",e.getMessage());
68         }
69     }
70     @Test
71     public void missingContextConfFileNameTest()  {
72         CLI cli = new CLI();
73         try {
74             String[] input = {"sourceFilePath","destinationPath","templateFileName","builderFQDN",null};
75             cli.main(input);
76         } catch (Exception e) {
77             Assert.assertEquals(e.getMessage(),"context conf file is missing. Please add argument 'client sourceFilePath destinationPath templateFileName builderFQDN <conf file>'");
78         }
79     }
80 }