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
|
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>'");
}
}
}
|