mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2025-01-18 19:20:05 +08:00
修复执行mvn test时多个TestCase失败的问题。失败原因:1)使用断言比较POJO对象时未忽略expiresTime、createTime、updateTime属性;2)初始化测试数据库时未以UTF8编码读取脚本
This commit is contained in:
parent
9b2ec3d341
commit
e36671255a
@ -114,7 +114,7 @@ public class JobLogServiceImplTest extends BaseDbUnitTest {
|
||||
assertEquals(1, count);
|
||||
List<JobLogDO> logs = jobLogMapper.selectList();
|
||||
assertEquals(1, logs.size());
|
||||
assertEquals(log02, logs.get(0));
|
||||
assertPojoEquals(log02, logs.get(0), "createTime", "updateTime");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -91,7 +91,7 @@ public class ApiAccessLogServiceImplTest extends BaseDbUnitTest {
|
||||
assertEquals(1, count);
|
||||
List<ApiAccessLogDO> logs = apiAccessLogMapper.selectList();
|
||||
assertEquals(1, logs.size());
|
||||
assertEquals(log02, logs.get(0));
|
||||
assertPojoEquals(log02, logs.get(0), "createTime", "updateTime");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -157,7 +157,7 @@ public class ApiErrorLogServiceImplTest extends BaseDbUnitTest {
|
||||
assertEquals(1, count);
|
||||
List<ApiErrorLogDO> logs = apiErrorLogMapper.selectList();
|
||||
assertEquals(1, logs.size());
|
||||
assertEquals(log02, logs.get(0));
|
||||
assertPojoEquals(log02, logs.get(0), "createTime", "updateTime");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ spring:
|
||||
sql:
|
||||
init:
|
||||
schema-locations: classpath:/sql/create_tables.sql
|
||||
encoding: UTF-8
|
||||
|
||||
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
||||
data:
|
||||
|
@ -209,7 +209,7 @@ public class OAuth2ApproveServiceImplTest extends BaseDbUnitTest {
|
||||
List<OAuth2ApproveDO> result = oauth2ApproveService.getApproveList(userId, userType, clientId);
|
||||
// 断言
|
||||
assertEquals(1, result.size());
|
||||
assertPojoEquals(approve, result.get(0));
|
||||
assertPojoEquals(approve, result.get(0), "expiresTime");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -50,7 +50,7 @@ class OAuth2CodeServiceImplTest extends BaseDbUnitTest {
|
||||
scopes, redirectUri, state);
|
||||
// 断言
|
||||
OAuth2CodeDO dbCodeDO = oauth2CodeMapper.selectByCode(codeDO.getCode());
|
||||
assertPojoEquals(codeDO, dbCodeDO, "createTime", "updateTime", "deleted");
|
||||
assertPojoEquals(codeDO, dbCodeDO, "expiresTime", "createTime", "updateTime", "deleted");
|
||||
assertEquals(userId, codeDO.getUserId());
|
||||
assertEquals(userType, codeDO.getUserType());
|
||||
assertEquals(clientId, codeDO.getClientId());
|
||||
@ -92,7 +92,7 @@ class OAuth2CodeServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
// 调用
|
||||
OAuth2CodeDO result = oauth2CodeService.consumeAuthorizationCode(code);
|
||||
assertPojoEquals(codeDO, result);
|
||||
assertPojoEquals(codeDO, result, "expiresTime");
|
||||
assertNull(oauth2CodeMapper.selectByCode(code));
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class OAuth2TokenServiceImplTest extends BaseDbAndRedisUnitTest {
|
||||
OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.createAccessToken(userId, userType, clientId, scopes);
|
||||
// 断言访问令牌
|
||||
OAuth2AccessTokenDO dbAccessTokenDO = oauth2AccessTokenMapper.selectByAccessToken(accessTokenDO.getAccessToken());
|
||||
assertPojoEquals(accessTokenDO, dbAccessTokenDO, "createTime", "updateTime", "deleted");
|
||||
assertPojoEquals(accessTokenDO, dbAccessTokenDO, "expiresTime", "createTime", "updateTime", "deleted");
|
||||
assertEquals(userId, accessTokenDO.getUserId());
|
||||
assertEquals(userType, accessTokenDO.getUserType());
|
||||
assertEquals(2, accessTokenDO.getUserInfo().size());
|
||||
@ -88,7 +88,7 @@ public class OAuth2TokenServiceImplTest extends BaseDbAndRedisUnitTest {
|
||||
assertFalse(DateUtils.isExpired(accessTokenDO.getExpiresTime()));
|
||||
// 断言访问令牌的缓存
|
||||
OAuth2AccessTokenDO redisAccessTokenDO = oauth2AccessTokenRedisDAO.get(accessTokenDO.getAccessToken());
|
||||
assertPojoEquals(accessTokenDO, redisAccessTokenDO, "createTime", "updateTime", "deleted");
|
||||
assertPojoEquals(accessTokenDO, redisAccessTokenDO, "expiresTime", "createTime", "updateTime", "deleted");
|
||||
// 断言刷新令牌
|
||||
OAuth2RefreshTokenDO refreshTokenDO = oauth2RefreshTokenMapper.selectList().get(0);
|
||||
assertPojoEquals(accessTokenDO, refreshTokenDO, "id", "expiresTime", "createTime", "updateTime", "deleted");
|
||||
@ -177,13 +177,13 @@ public class OAuth2TokenServiceImplTest extends BaseDbAndRedisUnitTest {
|
||||
assertNull(oauth2AccessTokenRedisDAO.get(accessTokenDO.getAccessToken()));
|
||||
// 断言,新的访问令牌
|
||||
OAuth2AccessTokenDO dbAccessTokenDO = oauth2AccessTokenMapper.selectByAccessToken(newAccessTokenDO.getAccessToken());
|
||||
assertPojoEquals(newAccessTokenDO, dbAccessTokenDO, "createTime", "updateTime", "deleted");
|
||||
assertPojoEquals(newAccessTokenDO, dbAccessTokenDO, "expiresTime", "createTime", "updateTime", "deleted");
|
||||
assertPojoEquals(newAccessTokenDO, refreshTokenDO, "id", "expiresTime", "createTime", "updateTime", "deleted",
|
||||
"creator", "updater");
|
||||
assertFalse(DateUtils.isExpired(newAccessTokenDO.getExpiresTime()));
|
||||
// 断言,新的访问令牌的缓存
|
||||
OAuth2AccessTokenDO redisAccessTokenDO = oauth2AccessTokenRedisDAO.get(newAccessTokenDO.getAccessToken());
|
||||
assertPojoEquals(newAccessTokenDO, redisAccessTokenDO, "createTime", "updateTime", "deleted");
|
||||
assertPojoEquals(newAccessTokenDO, redisAccessTokenDO, "expiresTime", "createTime", "updateTime", "deleted");
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -198,9 +198,9 @@ public class OAuth2TokenServiceImplTest extends BaseDbAndRedisUnitTest {
|
||||
// 调用
|
||||
OAuth2AccessTokenDO result = oauth2TokenService.getAccessToken(accessToken);
|
||||
// 断言
|
||||
assertPojoEquals(accessTokenDO, result, "createTime", "updateTime", "deleted",
|
||||
assertPojoEquals(accessTokenDO, result, "expiresTime", "createTime", "updateTime", "deleted",
|
||||
"creator", "updater");
|
||||
assertPojoEquals(accessTokenDO, oauth2AccessTokenRedisDAO.get(accessToken), "createTime", "updateTime", "deleted",
|
||||
assertPojoEquals(accessTokenDO, oauth2AccessTokenRedisDAO.get(accessToken), "expiresTime", "createTime", "updateTime", "deleted",
|
||||
"creator", "updater");
|
||||
}
|
||||
|
||||
@ -237,7 +237,7 @@ public class OAuth2TokenServiceImplTest extends BaseDbAndRedisUnitTest {
|
||||
// 调研,并断言
|
||||
OAuth2AccessTokenDO result = oauth2TokenService.getAccessToken(accessToken);
|
||||
// 断言
|
||||
assertPojoEquals(accessTokenDO, result, "createTime", "updateTime", "deleted",
|
||||
assertPojoEquals(accessTokenDO, result, "expiresTime", "createTime", "updateTime", "deleted",
|
||||
"creator", "updater");
|
||||
}
|
||||
|
||||
@ -259,7 +259,7 @@ public class OAuth2TokenServiceImplTest extends BaseDbAndRedisUnitTest {
|
||||
oauth2RefreshTokenMapper.insert(refreshTokenDO);
|
||||
// 调用
|
||||
OAuth2AccessTokenDO result = oauth2TokenService.removeAccessToken(accessTokenDO.getAccessToken());
|
||||
assertPojoEquals(accessTokenDO, result, "createTime", "updateTime", "deleted",
|
||||
assertPojoEquals(accessTokenDO, result, "expiresTime", "createTime", "updateTime", "deleted",
|
||||
"creator", "updater");
|
||||
// 断言数据
|
||||
assertNull(oauth2AccessTokenMapper.selectByAccessToken(accessTokenDO.getAccessToken()));
|
||||
@ -297,7 +297,7 @@ public class OAuth2TokenServiceImplTest extends BaseDbAndRedisUnitTest {
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbAccessToken, pageResult.getList().get(0));
|
||||
assertPojoEquals(dbAccessToken, pageResult.getList().get(0), "expiresTime");
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user