Browse Source

[Improvement-12856][UT] Refactor duplicated code fragment in UdfFuncMapperTest (#12857)

3.2.0-release
Guanhua Li 2 years ago committed by GitHub
parent
commit
83f9588eb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 38
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/UdfFuncMapperTest.java

38
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/UdfFuncMapperTest.java

@ -93,16 +93,7 @@ public class UdfFuncMapperTest extends BaseDaoTest {
* @return User
*/
private User insertOneUser() {
User user = new User();
user.setUserName("user1");
user.setUserPassword("1");
user.setEmail("xx@123.com");
user.setUserType(UserType.GENERAL_USER);
user.setCreateTime(new Date());
user.setTenantId(1);
user.setUpdateTime(new Date());
userMapper.insert(user);
return user;
return insertOneUser("user1");
}
/**
@ -111,6 +102,15 @@ public class UdfFuncMapperTest extends BaseDaoTest {
* @return User
*/
private User insertOneUser(String userName) {
return createGeneralUser(userName);
}
/**
* create general user
*
* @return User
*/
private User createGeneralUser(String userName) {
User user = new User();
user.setUserName(userName);
user.setUserPassword("1");
@ -140,24 +140,6 @@ public class UdfFuncMapperTest extends BaseDaoTest {
return udfUser;
}
/**
* create general user
*
* @return User
*/
private User createGeneralUser(String userName) {
User user = new User();
user.setUserName(userName);
user.setUserPassword("1");
user.setEmail("xx@123.com");
user.setUserType(UserType.GENERAL_USER);
user.setCreateTime(new Date());
user.setTenantId(1);
user.setUpdateTime(new Date());
userMapper.insert(user);
return user;
}
/**
* test update
*/

Loading…
Cancel
Save