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

}
相关推荐
CONTONUE18 小时前
如何调整yarn.nodemanager.vmem-pmem-ratio参数?
ide·eclipse
懒惰的橘猫3 天前
配置Hadoop集群-测试使用
java·ide·eclipse
深色風信子3 天前
Eclipse 插件开发 6 右键菜单
java·ide·eclipse·右键菜单
Arenaschi4 天前
运用fmpeg写一个背英文单词的demo带翻译
java·笔记·tcp/ip·其他·eclipse·maven
深色風信子6 天前
Eclipse 插件开发 5 编辑器
java·eclipse·编辑器
完美主义zx6 天前
Eclipse通过Tomcat启动web项目报错
eclipse·tomcat
冬天的雪20087 天前
eclipse中tomcat启动日志乱码
java·eclipse·tomcat
Bob99987 天前
基于晶晨S905L3B单网线盒子的Armbian 或openwrt应用
java·javascript·网络·数据结构·c++·python·eclipse
spencer_tseng12 天前
gradle eclipse [.project .classpath .settings]
java·ide·eclipse·gradle
深色風信子13 天前
Eclipse 插件开发 4 工具栏
java·eclipse·工具栏