@Test
public void getValueTest() throws Exception {
Request request = new Request();
Response response = new Response();
}
service class:
@PreAuthorize("(hasRole(@role.one) or (hasRole(@role.two) or hasRole(@role.three))) and @role.check(#requestObject)")
public Response getValue(Request requestObject) {
}
CheckRole class:
public boolean checkReturn(Request requestObject) {
Boolean response = true;
List<ReturnValueType> returnValueType = requestObject.getReturnType();
String role = Validator..getRole();
return response;
}
Mocking is failing at checkReturn
method of java as Validator is not having any roles.
Is there a way that we can mock the method call inside preauthorize annotation? Mocking the entire Role.java is not working as it is failing the other cases.