aboutsummaryrefslogtreecommitdiffstats
path: root/appc-client/code-generator/src/test/java/org/onap/appc/tools/generator/api/CLITest.java
blob: 4ae3c3b6192f10107eeae689ff9d553d5b7b15a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*-
 * ============LICENSE_START=======================================================
 * ONAP : APPC
 * ================================================================================
 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
 * ================================================================================
 * Copyright (C) 2017 Amdocs
 * =============================================================================
 * 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.
 * 
 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
 * ============LICENSE_END=========================================================
 */

package org.onap.appc.tools.generator.api;

import org.junit.Assert;
import org.junit.Test;

public class CLITest {
    @Test
    public void missingSourceFileTest()  {
        CLI cli = new CLI();
        try {
            String[] input = new String[1];
            cli.main(input);
        } catch (Exception e) {
            Assert.assertEquals("Source file is missing. Please add argument 'client <source file> <destination file> <model template>'",e.getMessage());
        }
    }
    @Test
    public void missingDestinationFileTest()  {
        CLI cli = new CLI();
        try {
            String[] input = {"sourceFilePath",null};
            cli.main(input);
        } catch (Exception e) {
            Assert.assertEquals("Destination file name is missing. Please add argument 'client sourceFilePath <destination> <model template> <builder> <conf file>'",e.getMessage());
        }
    }
    @Test
    public void missingTemplateFileTest()  {
        CLI cli = new CLI();
        try {
            String[] input = {"sourceFilePath","destinationPath",null};
            cli.main(input);
        } catch (Exception e) {
            Assert.assertEquals("template file name is missing. Please add argument 'client sourceFilePath destinationPath <model template> <builder> <conf file>'",e.getMessage());
        }
    }
    @Test
    public void missingBuilderNameTest()  {
        CLI cli = new CLI();
        try {
            String[] input = {"sourceFilePath","destinationPath","templateFileName",null};
            cli.main(input);
        } catch (Exception e) {
            Assert.assertEquals("builder FQDN is missing. Please add argument 'client sourceFilePath destinationPath templateFileName <builder> <conf file>'",e.getMessage());
        }
    }
    @Test
    public void missingContextConfFileNameTest()  {
        CLI cli = new CLI();
        try {
            String[] input = {"sourceFilePath","destinationPath","templateFileName","builderFQDN",null};
            cli.main(input);
        } catch (Exception e) {
            Assert.assertEquals(e.getMessage(),"context conf file is missing. Please add argument 'client sourceFilePath destinationPath templateFileName builderFQDN <conf file>'");
        }
    }
}