cli-profile unit test cases added
[cli.git] / profiles / command / src / test / java / org / onap / cli / fw / cmd / error / OnapCommandFailTest.java
1 /*\r
2  * Copyright 2022 Samsung Electronics\r
3  *\r
4  * Licensed under the Apache License, Version 2.0 (the "License");\r
5  * you may not use this file except in compliance with the License.\r
6  * You may obtain a copy of the License at\r
7  *\r
8  *     http://www.apache.org/licenses/LICENSE-2.0\r
9  *\r
10  * Unless required by applicable law or agreed to in writing, software\r
11  * distributed under the License is distributed on an "AS IS" BASIS,\r
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13  * See the License for the specific language governing permissions and\r
14  * limitations under the License.\r
15  */\r
16 \r
17 package org.onap.cli.fw.cmd.error;\r
18 \r
19 import org.junit.Test;\r
20 \r
21 import static org.junit.Assert.assertEquals;\r
22 \r
23 public class OnapCommandFailTest {\r
24 \r
25     @Test\r
26     public void OnapCommandCmdFailureTest() {\r
27         OnapCommandCmdFailure onapCommandCmdFailure = new OnapCommandCmdFailure("Argument value missing");\r
28         assertEquals("0x18001::Argument value missing", onapCommandCmdFailure.getMessage());\r
29     }\r
30 \r
31     @Test\r
32     public void OnapCommandCmdFailureWithCodeTest() {\r
33         OnapCommandCmdFailure onapCommandCmdFailure = new OnapCommandCmdFailure("Argument value missing",101);\r
34         assertEquals("101::0x18001::Argument value missing", onapCommandCmdFailure.getMessage());\r
35     }\r
36 \r
37     @Test\r
38     public void OnapCommandCmdFailureThrowableTest() {\r
39         OnapCommandCmdFailure onapCommandCmdFailure = new OnapCommandCmdFailure(new Exception("Argument value missing"));\r
40         assertEquals("0x18001::Argument value missing", onapCommandCmdFailure.getMessage());\r
41     }\r
42 \r
43     @Test\r
44     public void OnapCommandCmdFailureWithCodeThrowableTest() {\r
45         OnapCommandCmdFailure onapCommandCmdFailure = new OnapCommandCmdFailure(new Exception("Argument value missing"),101);\r
46         assertEquals("101::0x18001::Argument value missing", onapCommandCmdFailure.getMessage());\r
47     }\r
48 \r
49 }\r