2 * Copyright 2016 2015-2016 ZTE, Inc. and others. All rights reserved.
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.junit.Assert;
20 import org.junit.Test;
22 public class RegExpTestUtilTest {
25 public void testHostRegExpTest(){
26 boolean result=RegExpTestUtil.hostRegExpTest("127.0.0.1:8080");
27 Assert.assertTrue(result);
29 boolean err_result=RegExpTestUtil.hostRegExpTest("0.0.0.1:89");
30 Assert.assertFalse(err_result);
34 public void testIpRegExpTest(){
35 boolean result=RegExpTestUtil.ipRegExpTest("127.0.0.1");
36 Assert.assertTrue(result);
38 boolean err_result=RegExpTestUtil.ipRegExpTest("127.0.0.1.5");
39 Assert.assertFalse(err_result);
43 public void testPortRegExpTest(){
44 boolean result=RegExpTestUtil.portRegExpTest("80");
45 Assert.assertTrue(result);
47 boolean err_result=RegExpTestUtil.portRegExpTest("898989");
48 Assert.assertFalse(err_result);
52 public void testVersionRegExpTest(){
53 boolean result=RegExpTestUtil.versionRegExpTest("v1");
54 Assert.assertTrue(result);
56 boolean err_result=RegExpTestUtil.versionRegExpTest("23");
57 Assert.assertFalse(err_result);
61 public void testurlRegExpTest(){
62 boolean result=RegExpTestUtil.urlRegExpTest("/test");
63 Assert.assertTrue(result);
65 boolean err_result=RegExpTestUtil.urlRegExpTest("test");
66 Assert.assertFalse(err_result);
70 public void testapiRouteUrlRegExpTest(){
71 boolean result=RegExpTestUtil.apiRouteUrlRegExpTest("/api/test/v1");
72 Assert.assertTrue(result);
74 boolean err_result=RegExpTestUtil.apiRouteUrlRegExpTest("/test");
75 Assert.assertFalse(err_result);
79 public void testiuiRouteUrlRegExpTest(){
80 boolean result=RegExpTestUtil.iuiRouteUrlRegExpTest("/iui/test");
81 Assert.assertTrue(result);
83 boolean err_result=RegExpTestUtil.iuiRouteUrlRegExpTest("/test");
84 Assert.assertFalse(err_result);