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());
	   }

}
相关推荐
毕设源码-郭学长21 小时前
【开题答辩全过程】以 基于SSM的高校运动会管理系统的设计与实现为例,包含答辩的问题和答案
java·eclipse
spencer_tseng1 天前
eclipse ALT+SHIFT+A
java·ide·eclipse
麻雀1232 天前
win7中编译qemu-system-arm,仿真arm设备
c语言·eclipse
Java猿_2 天前
开发 Java 项目,选哪个 IDE?Eclipse、MyEclipse 与 IntelliJ IDEA 深度对比
java·ide·eclipse
期货资管源码3 天前
期货资管分仓软件开发/平台搭建经验分享
经验分享·算法·eclipse·区块链
曹牧3 天前
Eclipse:大小写转换的快捷键
eclipse
杂家3 天前
Hudi集成Flink
大数据·flink·eclipse
开开心心_Every4 天前
免费进销存管理软件:云端本地双部署
java·游戏·微信·eclipse·pdf·excel·语音识别
Tinachen885 天前
YonBIP旗舰版本地开发环境搭建教程
java·开发语言·oracle·eclipse·前端框架
浩子智控6 天前
电子产品设计企业知识管理
运维·服务器·eclipse·系统安全·硬件工程