use*_*150 5 jmockit spring-security mockito
@Test
public void getValueTest() throws Exception {
Request request = new Request();
Response response = new Response();
}
Run Code Online (Sandbox Code Playgroud)
服务等级:
@PreAuthorize("(hasRole(@role.one) or (hasRole(@role.two) or hasRole(@role.three))) and @role.check(#requestObject)")
public Response getValue(Request requestObject) {
}
Run Code Online (Sandbox Code Playgroud)
CheckRole 类:
public boolean checkReturn(Request requestObject) {
Boolean response = true;
List<ReturnValueType> returnValueType = requestObject.getReturnType();
String role = Validator..getRole();
return response;
}
Run Code Online (Sandbox Code Playgroud)
checkReturn由于 Validator 没有任何角色,因此模拟在java 方法中失败。
有没有办法模拟预授权注释中的方法调用?模拟整个 Role.java 不起作用,因为它在其他情况下失败了。
| 归档时间: |
|
| 查看次数: |
555 次 |
| 最近记录: |