REM:
1. 添加获取用户id单元测试。
This commit is contained in:
wangyiyun 2020-08-31 18:32:47 +08:00
parent 2f9b78df23
commit 6ca21ee928
2 changed files with 21 additions and 1 deletions

View File

@ -27,7 +27,9 @@ public enum DisposeTaskStatus implements BaseEnum {
* Task canceled task status. * Task canceled task status.
*/ */
TASK_CANCELED(4, "用户中止"), TASK_CANCELED(4, "用户中止"),
/**
* The Task expired.
*/
TASK_EXPIRED(5, "过期"), TASK_EXPIRED(5, "过期"),
; ;

View File

@ -38,6 +38,10 @@ public class UserAccountServiceTest extends InitTestEnvironment {
* The constant token. * The constant token.
*/ */
private static String token = ""; private static String token = "";
/**
* The constant string http auth head.
*/
public static final String STRING_HTTP_AUTH_HEAD = "Bearer ";
/** /**
* The User account service. * The User account service.
*/ */
@ -120,4 +124,18 @@ public class UserAccountServiceTest extends InitTestEnvironment {
Assert.assertEquals(userAccountService.authTokenCheck(token + "1235"), ErrorCode.ERR_LOGOUT); Assert.assertEquals(userAccountService.authTokenCheck(token + "1235"), ErrorCode.ERR_LOGOUT);
} }
} }
/**
* A 5 get user id by auth head test.
*/
@Test
public void a5_getUseIdByAuthHeadTest() {
long id = userAccountService.getUserIdByAuthHead(UserAccountServiceTest.STRING_HTTP_AUTH_HEAD + UserAccountServiceTest.token);
UserAccount useraccount = userAccountService.getUserByToken(UserAccountServiceTest.token);
if(id == -1){
Assert.assertNull(useraccount);
}
else{
Assert.assertEquals(id,1);
}
}
} }