1
2
3
4
5 package org.neo.swarm.interceptor.logging;
6
7 import java.lang.reflect.Method;
8 import java.util.ArrayList;
9
10 import junit.framework.TestCase;
11
12 import org.aopalliance.intercept.MethodInvocation;
13 import org.easymock.MockControl;
14 import org.neo.swarm.core.aop.silc.comp.MethodInterceptor;
15
16
17 /***
18 *
19 * @author navery
20 */
21 public class JavaLoggingInterceptorTest extends TestCase {
22
23 boolean invoked;
24
25 protected void setUp() throws Exception {
26 invoked = false;
27 }
28
29 public void testInfoLogging() throws Throwable {
30 MockControl methodControl = MockControl.createNiceControl(MethodInvocation.class);
31 MethodInvocation method = (MethodInvocation) methodControl.getMock();
32
33 methodControl.replay();
34
35 MethodInterceptor interceptor = new JavaLoggingInterceptor(true);
36 interceptor.invoke(method);
37
38 methodControl.verify();
39 }
40
41
42 public class MyClass {
43 private void logInfo(String msg){
44 invoked = true;
45 }
46 }
47 }