添加KeyValue单元测试和注释

This commit is contained in:
mazhicheng 2019-12-10 10:22:45 +08:00
parent 4b11fa5ba1
commit 08789ac9f9
3 changed files with 13 additions and 3 deletions

View File

@ -3,7 +3,7 @@ package com.diboot.core.vo;
import java.io.Serializable;
/**
* KeyValue键值对形式的VO
* KeyValue键值对形式的VO用于构建显示名Name-存储值Value形式的结果
* @author Mazhicheng
* @version v2.0
* @date 2019/1/4
@ -19,7 +19,7 @@ public class KeyValue implements Serializable {
}
/***
* key: 显示值
* key: 显示值需要显示的name/label文本
*/
private String k;

View File

@ -7,6 +7,7 @@ import com.diboot.core.service.DictionaryService;
import com.diboot.core.util.BeanUtils;
import com.diboot.core.util.SqlExecutor;
import com.diboot.core.util.V;
import com.diboot.core.vo.KeyValue;
import com.diboot.core.vo.Pagination;
import diboot.core.test.StartupApplication;
import diboot.core.test.config.SpringMvcConfig;
@ -134,6 +135,13 @@ public class BaseServiceTest {
Assert.assertTrue(success);
}
@Test
public void testKV(){
List<KeyValue> keyValues = dictionaryService.getKeyValueList("GENDER");
Assert.assertTrue(keyValues.size() == 2);
Assert.assertTrue(keyValues.get(0).getV().equals("M"));
}
/**
* 清空测试数据
* @param type

View File

@ -30,15 +30,17 @@ public class DTest {
}
@Test
public void test(){
public void testJsonResult(){
String token = "token";
JsonResult j1 = new JsonResult(token);
JsonResult j2 = new JsonResult(token, "申请token成功");
JsonResult j3 = new JsonResult(Status.OK, token);
JsonResult j4 = new JsonResult(Status.OK, token, "申请token成功");
JsonResult j5 = new JsonResult(Status.OK);
System.out.println(j1.getData());
System.out.println(j2.getData());
System.out.println(j3.getData());
System.out.println(j4.getData());
System.out.println(j5.getData());
}
}