public void testInvoke() throws Exception { MockInterceptor mi = new MockInterceptor("Hello"); Aspect aspect = new AspectImpl(mi); AopProxy aopProxy = new AopProxy(Hello.class, new Aspect[] {aspect}); Hello hello = (Hello) aopProxy.create(); assertEquals("1", "Hello", hello.greeting()); }
public void testThrowable() throws Exception { MockInterceptor mi = new MockInterceptor(); mi.setThrowable(new NullPointerException()); Hello hello = (Hello) mi.createProxy(Hello.class); try { hello.greeting(); fail("1"); } catch (NullPointerException ignore) { } }
public void testCreateProxy() throws Exception { MockInterceptor mi = new MockInterceptor("Hello"); Hello hello = (Hello) mi.createProxy(Hello.class); assertEquals("1", "Hello", hello.greeting()); }