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

}
相关推荐
不正经的码狗4 天前
JAVA 、Eclipse 安装及配置 JAVA 项目(无需配置环境)
java·eclipse
不正经的码狗4 天前
Eclipse汉化(快速,推荐)
java·eclipse
vx_BS813306 天前
【项目编号:project51629】Spring Boot 乡村自来水缴费系统:把抄表、水费生成与在线缴费做成一条数字化闭环
java·spring boot·eclipse·tomcat·maven
暮雨哀尘7 天前
JAVA基础练习(四):SpringBoot 实现简易登录功能
java·spring boot·eclipse·maven
智购科技自动售卖机厂家7 天前
设备一到夏天就频繁跳闸,从启动电流追到压缩机电容~YH
数据结构·人工智能·python·eclipse
vx_BS813307 天前
【项目编号:project51381】Spring Boot 婚纱摄影管理系统:套餐预约、在线咨询、支付与客片展示的一站式业务实现
java·spring boot·eclipse·tomcat·mybatis
解道Jdon9 天前
JDK 27发布:紧凑对象头、G1默认、量子安全TLS
ide·windows·git·svn·eclipse·github·visual studio
金融小师妹9 天前
事件驱动分析:美联储决议临近,黄金弱势运行的AI政策定价框架
大数据·eclipse·时序数据库
vx_BS8133010 天前
【项目编号:project49759】Spring Boot 宠物综合服务平台:商城、预约、咨询、活动与健康档案的一体化实现
java·spring boot·eclipse·tomcat·intellij-idea
颜颜yan_12 天前
Eclipse Theia 鸿蒙 PC 适配全记录:在 HarmonyOS PC 上运行完整 IDE 工作台
ide·eclipse·harmonyos