Skip to content

Commit 6a678d1

Browse files
Copilotbinarywang
andcommitted
移除测试中的Thread.sleep以提高测试稳定性
Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
1 parent 677ffe0 commit 6a678d1

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpServiceGetMsgAuditAccessTokenTest.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,8 @@ public void testGetMsgAuditAccessToken_ForceRefresh() throws WxErrorException {
6868
*/
6969
@Test
7070
public void testGetMsgAuditAccessToken_Expired() throws WxErrorException {
71-
// 设置一个已过期的token(过期时间为0)
72-
config.updateMsgAuditAccessToken("expired_token", 0);
73-
// 等待一下确保过期
74-
try {
75-
Thread.sleep(100);
76-
} catch (InterruptedException e) {
77-
Thread.currentThread().interrupt();
78-
}
71+
// 设置一个已过期的token(过期时间为负数,确保立即过期)
72+
config.updateMsgAuditAccessToken("expired_token", -1);
7973

8074
BaseWxCpServiceImpl service = createTestServiceWithMockToken(config, "refreshed_token");
8175

0 commit comments

Comments
 (0)