mirror of https://github.com/longtai-cn/hippo4j
parent
b909874a69
commit
fd96f51612
@ -0,0 +1,19 @@
|
|||||||
|
package cn.hippo4j.auth.filter;
|
||||||
|
|
||||||
|
import cn.hippo4j.common.toolkit.ReflectUtil;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.security.authentication.BadCredentialsException;
|
||||||
|
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||||
|
|
||||||
|
class JWTAuthenticationFilterTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getMessageTest() {
|
||||||
|
JWTAuthenticationFilter filter = new JWTAuthenticationFilter(null);
|
||||||
|
Assertions.assertEquals("用户不存在", ReflectUtil.invoke(filter,
|
||||||
|
"getMessage", new UsernameNotFoundException("")));
|
||||||
|
Assertions.assertEquals("密码错误", ReflectUtil.invoke(filter,
|
||||||
|
"getMessage", new BadCredentialsException("")));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue