コード例 #1
0
 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());
 }
コード例 #2
0
 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) {
   }
 }
コード例 #3
0
 public void testCreateProxy() throws Exception {
   MockInterceptor mi = new MockInterceptor("Hello");
   Hello hello = (Hello) mi.createProxy(Hello.class);
   assertEquals("1", "Hello", hello.greeting());
 }