CheckPointUtilsTest

导入依赖

xml 复制代码
		<dependency>
			<groupId>org.uncommons</groupId>
			<artifactId>reportng</artifactId>
			<version>1.1.5</version>
			<scope>system</scope>
			<systemPath>${basedir}/libs/checkpoint.jar</systemPath>
		</dependency>

把打包好的jar包引入到xml设置的libs路径下

代码

xml 复制代码
package com.amat.fastjson;

import com.github.checkpoint.CheckPointUtils;

public class CheckPointUtilsTest {
	   public static void main(String[] args) {
		    //jsonobject 测试
			System.out.println("-----json校验");
		    String testjson ="{\"uid\":\"test\"}";
			System.out.println(CheckPointUtils.check(testjson,"uid=test").getMsg());
			
			System.out.println("-----不存在值判断");
			System.out.println(CheckPointUtils.check(testjson,"test=12").getMsg());
			
			//json数组测试
			System.out.println("-----json数组测试");
			String testjson2="{\"code\":\"1\",\"data\":[{\"name\":\"testfan0\",\"pwd\":\"pwd0\"},{\"name\":\"testfan1\",\"pwd\":\"pwd1\"},{\"name\":\"testfan2\",\"pwd\":\"pwd2\"}]}";
			System.out.println(CheckPointUtils.check(testjson2,"..name[0]=testfan0").getMsg());
			//函数测试 
			System.out.println("-----函数测试 ");
		    System.out.println(CheckPointUtils.check(testjson2,"data.size()>5").getMsg());
			//多值组合测试
		    System.out.println("-----多值组合测试 ");
		    String testjson3 ="{\"msg\":\"登录成功\",\"uid\":\"DAD3483647A94DBDB174C4C036CA8A80\",\"code\":\"1\",\"code2\":\"2\",\"code3\":\"3\"}";
		   // CheckPointUtils.openLog=true;
		    System.out.println(CheckPointUtils.check(testjson3,"code=1&&code2>=4&&code3>=4").getMsg());
	   }

}
相关推荐
毕设源码-钟学长12 小时前
【开题答辩全过程】以 濒危动物保护管理系统为例,包含答辩的问题和答案
java·eclipse
Excuse_lighttime18 小时前
只出现一次的数字(位运算算法)
java·数据结构·算法·leetcode·eclipse
spencer_tseng2 天前
Eclipse 4.7 ADT (Android Development Tools For Eclipse)
android·java·eclipse
毕设源码-郭学长4 天前
【开题答辩全过程】以 办公管理系统为例,包含答辩的问题和答案
java·eclipse
毕设源码-赖学姐4 天前
【开题答辩全过程】以 网络药店管理系统为例,包含答辩的问题和答案
java·eclipse
安逸sgr5 天前
SpringMVC启动流程
java·jvm·spring·spring cloud·eclipse·tomcat·maven
毕设源码-朱学姐5 天前
【开题答辩全过程】以 办公自动化管理系统为例,包含答辩的问题和答案
java·eclipse
diehappy6 天前
SELECT‘探索SQL语言在数据分析中的核心优势与实战应用‘ASarticle_title;
eclipse
量子物理学6 天前
Eclipse Mosquitto 在小内存下怎么修改配置文件
java·服务器·eclipse
咕噜咕噜啦啦6 天前
Eclipse集成开发环境的使用
java·ide·eclipse