zoukankan      html  css  js  c++  java
  • 对字符串做正则表达式的比较,只比较字符串,不对字符串的值进行比对

       public boolean compareRegexString(String testName, String wsValue, String expectValue) {
            boolean result = false;
            String resultInfo = LR;
            resultInfo += "WS: " +wsValue+ LR;
            resultInfo += "Expect: " +expectValue+ LR;
            /**
             * 接下来是判断和记录结果过程
             */
            if ((expectValue == null || expectValue.length() == 0) && (wsValue == null || wsValue.length() == 0)) {
                result = true;
                resultInfo = PASS + LR + resultInfo;
            } else {
                Pattern pattern = Pattern.compile(expectValue);
                Matcher matcher = pattern.matcher(wsValue);
                result = matcher.find();
                if (result == true) {
                    resultInfo = PASS + LR + resultInfo;
                    Assert.assertTrue(result);
                } else {
                    resultInfo = FAIL + LR + resultInfo;
                    Assert.assertEquals(wsValue, expectValue);
                }
            }
            setStrResultInfo(resultInfo);
            writeReportResultInfo(result);
    //            writeLog(testName);
            getReturnMap().put(testName, wsValue);
            return result;
        }

    wsValue= {"code":"10000","msg":null,"data":{"untilnow_pv":0.007830058221967192,"DirectUsage":0.007830058222127264,"Charges_pv":0.007812278694385896,"Feedin_pv":0.0}}
    expectValue="untilnow_pv":S+,"DirectUsage":S+,"Charges_pv":S+,"Feedin_pv":S+

      

  • 相关阅读:
    mysql之SQL入门与提升(三)
    DROOLS通过URL访问changset
    drools规则管理Guvnor的安装
    kafka offset manage
    kafka comsumer
    kafka与zookeeper
    kafka数据祸福和failover
    kafka一些问题点的分析
    近期开发storm遇到一些问题的解决点
    关于大数据平台ETL可行性方案
  • 原文地址:https://www.cnblogs.com/hong0632/p/7866033.html
Copyright © 2011-2022 走看看