Code example for ProxyFactory

Methods: getProxy, addAdvice

0
        SecurityContextHolder.clearContext(); 
    } 
 
    private void createTarget(boolean useMock) { 
        realTarget = useMock ? mock(ITargetObject.class) : new TargetObject(); 
        ProxyFactory pf = new ProxyFactory(realTarget); 
        pf.addAdvice(interceptor); 
        advisedTarget = (ITargetObject) pf.getProxy(); 
    } 
 
    @Test 
    public void gettersReturnExpectedData() { 
        RunAsManager runAs = mock(RunAsManager.class); 
        AfterInvocationManager aim = mock(AfterInvocationManager.class); 
        interceptor.setRunAsManager(runAs); 
        interceptor.setAfterInvocationManager(aim); 
        assertEquals(adm, interceptor.getAccessDecisionManager()); 
        assertEquals(runAs, interceptor.getRunAsManager()); 
        assertEquals(authman, interceptor.getAuthenticationManager()); 
        assertEquals(mds, interceptor.getSecurityMetadataSource());