Code example for ProxyFactory

Methods: getProxy, addAdvisor, setProxyTargetClass, setTarget

0
 
    @Before 
    public void setUp() { 
        MockitoAnnotations.initMocks(this);
 
        ProxyFactory factory = new ProxyFactory();
        factory.setProxyTargetClass(true);
        ExceptionTranslationAdvice advice = new ExceptionTranslationAdvice();
        advice.getExceptionTranslators().add(new TestExceptionTranslator());
        factory.addAdvisor(new EndpointServiceMessagePointcutAdvisor(advice));
        factory.setTarget(this.endpoint);
        this.advisedEndpoint = (AbstractEndpoint) factory.getProxy();
    } 
 
    @Test
    public void knownException() { 
 
        when(this.endpoint.serviceMessage(this.inMessage)).thenThrow(new TestException());
 
        try { 
Contextual code suggestions in your IDE  Get Codota for Java