DocumentrMethodSecurityExpressionHandler extends DefaultMethodSecurityExpressionHandler { @Override protected MethodSecurityExpressionOperations createSecurityExpressionRoot(Authentication authentication, MethodInvocation invocation) { DocumentrSecurityExpressionRoot root = new DocumentrSecurityExpressionRoot(authentication, repoManager); root.setThis(invocation.getThis()); root.setPermissionEvaluator(getPermissionEvaluator()); return root; }  @PostConstruct void init();  }
@Test public void createSecurityExpressionRoot() { Object target = "this"; when(methodInvocation.getThis()).thenReturn(target); DocumentrSecurityExpressionRoot root = (DocumentrSecurityExpressionRoot) expressionHandler.createSecurityExpressionRoot( authentication, methodInvocation); assertSame(target, root.getThis()); assertSame(permissionEvaluator, Whitebox.getInternalState(root, DocumentrPermissionEvaluator.class)); }