2 * Copyright (C) 2016 ZTE, Inc. and others. All rights reserved. (ZTE)
\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
8 * http://www.apache.org/licenses/LICENSE-2.0
\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
16 package org.openo.msb.wrapper.util;
\r
18 import org.apache.commons.lang3.StringUtils;
\r
19 import org.junit.Assert;
\r
20 import org.junit.Test;
\r
22 public class RouteUtilTest {
\r
25 public void testGetPrefixedKey(){
\r
26 String path=RouteUtil.getPrefixedKey("","test","v1");
\r
27 Assert.assertEquals("msb:routing:test:v1",path);
\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
36 Assert.assertEquals(3,str3.length);
\r
40 public void testContainStr(){
\r
42 String array[]={"1","2"};
\r
43 boolean result=RouteUtil.contain(array, value);
\r
44 Assert.assertTrue(result);
\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
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