Hi~ kunshuai,

You can also use mockito, There is a sample here
https://github.com/apache/incubator-shenyu/blob/38b63d28b245dbd4070f054baff056091020f171/shenyu-client/shenyu-client-http/shenyu-client-springcloud/src/test/java/org/apache/shenyu/client/springcloud/init/SpringCloudClientBeanPostProcessorTest.java#L84

Kunshuai Zhu <[email protected]> 于2021年7月31日周六 下午7:59写道:

> Hi friends,
> I ran into trouble while writing unit tests. You can see
> `PermissionServiceImpl#getPermissionMenu`.
> The code in 74th line is `UserInfo userInfo = JwtUtils.getUserInfo();`
> Here comes the problem that it will throw NullPointerException. So
> that the following lines can't be test.
> What should i do? Can I import "powermock" to mock
> `JwtUtils.getUserInfo()`?
>

Reply via email to