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

}
相关推荐
xiaozaq1 天前
在Eclipse中安装Lombok插件
java·python·eclipse
匆匆整棹还2 天前
eclipse查看源码
java·ide·eclipse
开开心心就好3 天前
安卓免费多功能工具:一站式解决 PDF 阅读、编辑、转换等需求
java·人工智能·windows·python·eclipse·pdf·软件需求
秦哈哈6 天前
【Maven】将普通Eclipse项目改造为Maven项目(非SpringBoot项目)
eclipse·maven
围城少年11 天前
mac 安装Eclipse,汉化及安装ERMaster
java·eclipse
风与沙的较量丶12 天前
关于eclipse中的clean up ,format ,clean的一些小说明
java·ide·eclipse
B站计算机毕业设计超人13 天前
计算机毕业设计SpringBoot+Vue.jst网上超市系统(源码+LW文档+PPT+讲解)
vue.js·spring boot·后端·eclipse·intellij-idea·mybatis·课程设计
waicsdn_haha13 天前
Eclipse IDE 2025-03 最新版安装教程(官方下载+环境配置详解)
java·linux·开发语言·ide·windows·fpga开发·eclipse
Distance失落心14 天前
idea任意版本的安装
java·ide·java-ee·eclipse·intellij-idea
B站计算机毕业设计超人14 天前
计算机毕业设计SpringBoot+Vue.jst房屋租赁系统(源码+LW文档+PPT+讲解)
vue.js·spring boot·后端·eclipse·intellij-idea·mybatis·课程设计