+++ /dev/null
-/**\r
-* Copyright (C) 2016 ZTE, Inc. and others. All rights reserved. (ZTE)\r
-*\r
-* Licensed under the Apache License, Version 2.0 (the "License");\r
-* you may not use this file except in compliance with the License.\r
-* You may obtain a copy of the License at\r
-*\r
-* http://www.apache.org/licenses/LICENSE-2.0\r
-*\r
-* Unless required by applicable law or agreed to in writing, software\r
-* distributed under the License is distributed on an "AS IS" BASIS,\r
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-* See the License for the specific language governing permissions and\r
-* limitations under the License.\r
-*/\r
-package org.openo.msb.wrapper.util;\r
-\r
-import org.junit.Assert;\r
-\r
-import org.junit.Test;\r
-\r
-public class RegExpTestUtilTest {\r
-\r
- @Test\r
- public void testHostRegExpTest(){\r
- boolean result=RegExpTestUtil.hostRegExpTest("127.0.0.1:8080");\r
- Assert.assertTrue(result);\r
- \r
- boolean err_result=RegExpTestUtil.hostRegExpTest("0.0.0.1:89");\r
- Assert.assertFalse(err_result);\r
- }\r
- \r
- @Test\r
- public void testIpRegExpTest(){\r
- boolean result=RegExpTestUtil.ipRegExpTest("127.0.0.1");\r
- Assert.assertTrue(result);\r
- \r
- boolean err_result=RegExpTestUtil.ipRegExpTest("127.0.0.1.5");\r
- Assert.assertFalse(err_result);\r
- }\r
- \r
- @Test\r
- public void testPortRegExpTest(){\r
- boolean result=RegExpTestUtil.portRegExpTest("80");\r
- Assert.assertTrue(result);\r
- \r
- boolean err_result=RegExpTestUtil.portRegExpTest("898989");\r
- Assert.assertFalse(err_result);\r
- }\r
- \r
- @Test\r
- public void testVersionRegExpTest(){\r
- boolean result=RegExpTestUtil.versionRegExpTest("v1");\r
- Assert.assertTrue(result);\r
- \r
- boolean err_result=RegExpTestUtil.versionRegExpTest("23");\r
- Assert.assertFalse(err_result);\r
- }\r
- \r
- @Test\r
- public void testurlRegExpTest(){\r
- boolean result=RegExpTestUtil.urlRegExpTest("/test");\r
- Assert.assertTrue(result);\r
- \r
- boolean err_result=RegExpTestUtil.urlRegExpTest("test");\r
- Assert.assertFalse(err_result);\r
- }\r
- \r
- @Test\r
- public void testapiRouteUrlRegExpTest(){\r
- boolean result=RegExpTestUtil.apiRouteUrlRegExpTest("/api/test/v1");\r
- Assert.assertTrue(result);\r
- \r
- boolean err_result=RegExpTestUtil.apiRouteUrlRegExpTest("/test");\r
- Assert.assertFalse(err_result);\r
- }\r
- \r
- @Test\r
- public void testiuiRouteUrlRegExpTest(){\r
- boolean result=RegExpTestUtil.iuiRouteUrlRegExpTest("/iui/test");\r
- Assert.assertTrue(result);\r
- \r
- boolean err_result=RegExpTestUtil.iuiRouteUrlRegExpTest("/test");\r
- Assert.assertFalse(err_result);\r
- }\r
-}\r