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