Merge "Initial code import"
[msb/apigateway.git] / apiroute / apiroute-service / src / test / java / org / openo / msb / wrapper / util / RouteUtilTest.java
1 /**\r
2 * Copyright (C) 2016 ZTE, Inc. and others. All rights reserved. (ZTE)\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 package org.openo.msb.wrapper.util;\r
17 \r
18 import org.apache.commons.lang3.StringUtils;\r
19 import org.junit.Assert;\r
20 import org.junit.Test;\r
21 \r
22 public class RouteUtilTest {\r
23     \r
24     @Test\r
25     public void testGetPrefixedKey(){\r
26         String path=RouteUtil.getPrefixedKey("","test","v1");\r
27         Assert.assertEquals("msb:routing:test:v1",path);\r
28     }\r
29     \r
30     @Test\r
31     public void testConcat(){\r
32         Object[] str1=new String[]{"test1","test2"}; \r
33         Object[] str2=new String[]{"test3"}; \r
34         Object[] str3=RouteUtil.concat(str1, str2);\r
35         \r
36         Assert.assertEquals(3,str3.length);\r
37     }\r
38     \r
39     @Test\r
40     public void testContainStr(){\r
41         String value="1";\r
42         String array[]={"1","2"};\r
43         boolean result=RouteUtil.contain(array, value);\r
44         Assert.assertTrue(result);\r
45     }\r
46     \r
47     @Test\r
48     public void testContainArray(){\r
49         String value[]={"0"};\r
50         String array[]={"1","2"};\r
51         boolean result=RouteUtil.contain(array, value);\r
52         Assert.assertFalse(result);\r
53         \r
54     }\r
55     \r
56     @Test\r
57     public void testShow(){\r
58         String array[]={"1","2"};\r
59         String result=RouteUtil.show(array);\r
60         Assert.assertEquals("1|2",result);\r
61         \r
62     }\r
63 \r
64 }\r