List of usage examples for org.springframework.aop.framework DefaultAopProxyFactory createAopProxy
@Override
public AopProxy createAopProxy(AdvisedSupport config) throws AopConfigException
From source file:com.yeahmobi.yunit.testutils.MustNotSwallowSpringJUnit4ClassRunner.java
@Override public void run(RunNotifier notifier) { AdvisedSupport config = new AdvisedSupport(); config.setTarget(notifier);/*from ww w . jav a 2 s. c o m*/ config.addAdvice(new org.aopalliance.intercept.MethodInterceptor() { public Object invoke(MethodInvocation invocation) throws Throwable { if ("fireTestFailure".equals(invocation.getMethod().getName())) { Failure failure = (Failure) invocation.getArguments()[0]; if (failure.getException() instanceof NotSwallowedException) { // We expect this return null; } } return invocation.proceed(); } }); DefaultAopProxyFactory aopProxyFactory = new DefaultAopProxyFactory(); RunNotifier runNotifierProxy = (RunNotifier) aopProxyFactory.createAopProxy(config).getProxy(); super.run(runNotifierProxy); }