2 * Copyright 2016 ZTE Corporation.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.openo.msb.wrapper.util;
18 import org.apache.commons.lang3.StringUtils;
19 import org.junit.Assert;
20 import org.junit.Test;
22 public class RouteUtilTest {
25 public void testGetPrefixedKey(){
26 String path=RouteUtil.getPrefixedKey("","test","v1");
27 Assert.assertEquals("msb:routing:test:v1",path);
31 public void testConcat(){
32 Object[] str1=new String[]{"test1","test2"};
33 Object[] str2=new String[]{"test3"};
34 Object[] str3=RouteUtil.concat(str1, str2);
36 Assert.assertEquals(3,str3.length);
40 public void testContainStr(){
42 String array[]={"1","2"};
43 boolean result=RouteUtil.contain(array, value);
44 Assert.assertTrue(result);
48 public void testContainArray(){
50 String array[]={"1","2"};
51 boolean result=RouteUtil.contain(array, value);
52 Assert.assertFalse(result);
57 public void testShow(){
58 String array[]={"1","2"};
59 String result=RouteUtil.show(array);
60 Assert.assertEquals("1|2",result);