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

}
相关推荐
毕设源码-朱学姐2 天前
【开题答辩全过程】以 广州网红点打卡介绍网站为例,包含答辩的问题和答案
java·eclipse
百锦再2 天前
金仓数据库提出“三低一平”的迁移理念
开发语言·数据库·后端·python·rust·eclipse·pygame
数据牧羊人的成长笔记2 天前
Hadoop 分布式计算MapReduce和资源管理Yarn
hadoop·eclipse·mapreduce
百锦再3 天前
第5章 所有权系统
运维·git·python·eclipse·go·github·负载均衡
毕设源码-赖学姐4 天前
【开题答辩全过程】以 二手交易系统的设计与实现为例,包含答辩的问题和答案
java·eclipse
百锦再5 天前
第2章 第一个Rust程序
java·开发语言·后端·rust·eclipse·tomcat·hibernate
安冬的码畜日常6 天前
【JUnit实战3_21】第十二章:JUnit 5 与主流 IDE 的集成 + 第十三章:用 JUnit 5 做持续集成(上):在本地安装 Jenkins
junit·eclipse·jenkins·intellij idea·持续集成·junit5·netbeans
毕设源码-郭学长7 天前
【开题答辩全过程】以 常二社区线上养老院管理系统为例,包含答辩的问题和答案
java·eclipse
wa的一声哭了8 天前
Mac os安装Easyconnect卡在正在验证软件包
运维·服务器·git·macos·eclipse·github·mac
毕设源码-钟学长9 天前
【开题答辩全过程】以 儿童游泳预约系统为例,包含答辩的问题和答案
java·eclipse