Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
237455f8
Unverified
提交
237455f8
authored
3月 11, 2023
作者:
芋道源码
提交者:
Gitee
3月 11, 2023
浏览文件
操作
浏览文件
下载
差异文件
!27 test: 字典数据模块单元测试
Merge pull request !27 from 与或非/gaibu/20230309
上级
5f96b50b
853fb4b2
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
58 行增加
和
1 行删除
+58
-1
pom.xml
yudao-framework/yudao-spring-boot-starter-biz-dict/pom.xml
+7
-0
DictFrameworkUtilsTest.java
...work/datapermission/core/util/DictFrameworkUtilsTest.java
+50
-0
OperateLog.java
...dao/framework/operatelog/core/annotations/OperateLog.java
+1
-1
没有找到文件。
yudao-framework/yudao-spring-boot-starter-biz-dict/pom.xml
浏览文件 @
237455f8
...
...
@@ -46,5 +46,12 @@
<groupId>
com.google.guava
</groupId>
<artifactId>
guava
</artifactId>
</dependency>
<!-- Test 测试相关 -->
<dependency>
<groupId>
cn.iocoder.cloud
</groupId>
<artifactId>
yudao-spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
</dependencies>
</project>
yudao-framework/yudao-spring-boot-starter-biz-dict/src/test/java/cn/iocoder/yudao/framework/datapermission/core/util/DictFrameworkUtilsTest.java
0 → 100644
浏览文件 @
237455f8
package
cn
.
iocoder
.
yudao
.
framework
.
datapermission
.
core
.
util
;
import
cn.iocoder.yudao.framework.common.enums.CommonStatusEnum
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils
;
import
cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest
;
import
cn.iocoder.yudao.module.system.api.dict.DictDataApi
;
import
cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.Test
;
import
org.mockito.Mock
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
test
.
core
.
util
.
RandomUtils
.
randomPojo
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
import
static
org
.
mockito
.
Mockito
.
when
;
/**
* {@link DictFrameworkUtils} 的单元测试
*/
public
class
DictFrameworkUtilsTest
extends
BaseMockitoUnitTest
{
@Mock
private
DictDataApi
dictDataApi
;
@BeforeEach
public
void
setUp
()
{
DictFrameworkUtils
.
init
(
dictDataApi
);
}
@Test
public
void
testGetDictDataLabel
()
{
// mock 数据
DictDataRespDTO
dataRespDTO
=
randomPojo
(
DictDataRespDTO
.
class
,
o
->
o
.
setStatus
(
CommonStatusEnum
.
ENABLE
.
getStatus
()));
// mock 方法
when
(
dictDataApi
.
getDictData
(
dataRespDTO
.
getDictType
(),
dataRespDTO
.
getValue
())).
thenReturn
(
CommonResult
.
success
(
dataRespDTO
));
// 断言返回值
assertEquals
(
dataRespDTO
.
getLabel
(),
DictFrameworkUtils
.
getDictDataLabel
(
dataRespDTO
.
getDictType
(),
dataRespDTO
.
getValue
()));
}
@Test
public
void
testParseDictDataValue
()
{
// mock 数据
DictDataRespDTO
resp
=
randomPojo
(
DictDataRespDTO
.
class
,
o
->
o
.
setStatus
(
CommonStatusEnum
.
ENABLE
.
getStatus
()));
// mock 方法
when
(
dictDataApi
.
parseDictData
(
resp
.
getDictType
(),
resp
.
getLabel
())).
thenReturn
(
CommonResult
.
success
(
resp
));
// 断言返回值
assertEquals
(
resp
.
getValue
(),
DictFrameworkUtils
.
parseDictDataValue
(
resp
.
getDictType
(),
resp
.
getLabel
()));
}
}
yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/annotations/OperateLog.java
浏览文件 @
237455f8
...
...
@@ -29,7 +29,7 @@ public @interface OperateLog {
/**
* 操作名
*
* 为空时,会尝试读取 {@link
ApiOperation#value
()} 属性
* 为空时,会尝试读取 {@link
Operation#summary
()} 属性
*/
String
name
()
default
""
;
/**
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论