@ -137,7 +137,7 @@ public class ConfigServiceTest extends BaseDbUnitTest {
// 准备参数
// 准备参数
String key = randomString ( ) ;
String key = randomString ( ) ;
// mock 数据
// mock 数据
configMapper . insert ( randomConfigDO ( o - > o . set Key( key ) ) ) ;
configMapper . insert ( randomConfigDO ( o - > o . set Config Key( key ) ) ) ;
// 调用,校验异常
// 调用,校验异常
assertServiceException ( ( ) - > configService . checkConfigKeyUnique ( null , key ) ,
assertServiceException ( ( ) - > configService . checkConfigKeyUnique ( null , key ) ,
@ -150,7 +150,7 @@ public class ConfigServiceTest extends BaseDbUnitTest {
Long id = randomLongId ( ) ;
Long id = randomLongId ( ) ;
String key = randomString ( ) ;
String key = randomString ( ) ;
// mock 数据
// mock 数据
configMapper . insert ( randomConfigDO ( o - > o . set Key( key ) ) ) ;
configMapper . insert ( randomConfigDO ( o - > o . set Config Key( key ) ) ) ;
// 调用,校验异常
// 调用,校验异常
assertServiceException ( ( ) - > configService . checkConfigKeyUnique ( id , key ) ,
assertServiceException ( ( ) - > configService . checkConfigKeyUnique ( id , key ) ,
@ -162,7 +162,7 @@ public class ConfigServiceTest extends BaseDbUnitTest {
// mock 数据
// mock 数据
ConfigDO dbConfig = randomConfigDO ( o - > { // 等会查询到
ConfigDO dbConfig = randomConfigDO ( o - > { // 等会查询到
o . setName ( "芋艿" ) ;
o . setName ( "芋艿" ) ;
o . set Key( "yunai" ) ;
o . set Config Key( "yunai" ) ;
o . setType ( ConfigTypeEnum . SYSTEM . getType ( ) ) ;
o . setType ( ConfigTypeEnum . SYSTEM . getType ( ) ) ;
o . setCreateTime ( buildTime ( 2021 , 2 , 1 ) ) ;
o . setCreateTime ( buildTime ( 2021 , 2 , 1 ) ) ;
} ) ;
} ) ;
@ -170,7 +170,7 @@ public class ConfigServiceTest extends BaseDbUnitTest {
// 测试 name 不匹配
// 测试 name 不匹配
configMapper . insert ( ObjectUtils . cloneIgnoreId ( dbConfig , o - > o . setName ( "土豆" ) ) ) ;
configMapper . insert ( ObjectUtils . cloneIgnoreId ( dbConfig , o - > o . setName ( "土豆" ) ) ) ;
// 测试 key 不匹配
// 测试 key 不匹配
configMapper . insert ( ObjectUtils . cloneIgnoreId ( dbConfig , o - > o . set Key( "tudou" ) ) ) ;
configMapper . insert ( ObjectUtils . cloneIgnoreId ( dbConfig , o - > o . set Config Key( "tudou" ) ) ) ;
// 测试 type 不匹配
// 测试 type 不匹配
configMapper . insert ( ObjectUtils . cloneIgnoreId ( dbConfig , o - > o . setType ( ConfigTypeEnum . CUSTOM . getType ( ) ) ) ) ;
configMapper . insert ( ObjectUtils . cloneIgnoreId ( dbConfig , o - > o . setType ( ConfigTypeEnum . CUSTOM . getType ( ) ) ) ) ;
// 测试 createTime 不匹配
// 测试 createTime 不匹配
@ -196,7 +196,7 @@ public class ConfigServiceTest extends BaseDbUnitTest {
// mock 数据
// mock 数据
ConfigDO dbConfig = randomConfigDO ( o - > { // 等会查询到
ConfigDO dbConfig = randomConfigDO ( o - > { // 等会查询到
o . setName ( "芋艿" ) ;
o . setName ( "芋艿" ) ;
o . set Key( "yunai" ) ;
o . set Config Key( "yunai" ) ;
o . setType ( ConfigTypeEnum . SYSTEM . getType ( ) ) ;
o . setType ( ConfigTypeEnum . SYSTEM . getType ( ) ) ;
o . setCreateTime ( buildTime ( 2021 , 2 , 1 ) ) ;
o . setCreateTime ( buildTime ( 2021 , 2 , 1 ) ) ;
} ) ;
} ) ;
@ -204,7 +204,7 @@ public class ConfigServiceTest extends BaseDbUnitTest {
// 测试 name 不匹配
// 测试 name 不匹配
configMapper . insert ( ObjectUtils . cloneIgnoreId ( dbConfig , o - > o . setName ( "土豆" ) ) ) ;
configMapper . insert ( ObjectUtils . cloneIgnoreId ( dbConfig , o - > o . setName ( "土豆" ) ) ) ;
// 测试 key 不匹配
// 测试 key 不匹配
configMapper . insert ( ObjectUtils . cloneIgnoreId ( dbConfig , o - > o . set Key( "tudou" ) ) ) ;
configMapper . insert ( ObjectUtils . cloneIgnoreId ( dbConfig , o - > o . set Config Key( "tudou" ) ) ) ;
// 测试 type 不匹配
// 测试 type 不匹配
configMapper . insert ( ObjectUtils . cloneIgnoreId ( dbConfig , o - > o . setType ( ConfigTypeEnum . CUSTOM . getType ( ) ) ) ) ;
configMapper . insert ( ObjectUtils . cloneIgnoreId ( dbConfig , o - > o . setType ( ConfigTypeEnum . CUSTOM . getType ( ) ) ) ) ;
// 测试 createTime 不匹配
// 测试 createTime 不匹配
@ -230,7 +230,7 @@ public class ConfigServiceTest extends BaseDbUnitTest {
ConfigDO dbConfig = randomConfigDO ( ) ;
ConfigDO dbConfig = randomConfigDO ( ) ;
configMapper . insert ( dbConfig ) ; // @Sql: 先插入出一条存在的数据
configMapper . insert ( dbConfig ) ; // @Sql: 先插入出一条存在的数据
// 准备参数
// 准备参数
String key = dbConfig . get Key( ) ;
String key = dbConfig . get Config Key( ) ;
// 调用
// 调用
ConfigDO config = configService . getConfigByKey ( key ) ;
ConfigDO config = configService . getConfigByKey ( key ) ;