1   /*
2    * Created on May 12, 2004
3    *
4    *
5    */
6   package org.neo.swarm.interceptor.logging;
7   
8   import org.neo.swarm.core.aop.silc.comp.Invocation;
9   import org.neo.swarm.interceptor.logging.TracingInterceptor;
10  
11  import com.mockobjects.dynamic.Mock;
12  
13  import junit.framework.TestCase;
14  
15  
16  /***
17   * This object does..
18   *  @author navery
19   */
20  public class TracingInterceptorTest extends TestCase {
21  	
22  	public void testLoggerWithNormalInvocation() throws Exception, Throwable {
23  		
24  		Mock invocation = new Mock(Invocation.class);
25  		invocation.expectAndReturn("toString", "blah");
26  		invocation.expectAndReturn("proceed", null);
27  		
28  		TracingInterceptor logger =new TracingInterceptor(true);
29  		logger.invoke((Invocation) invocation.proxy());
30  		invocation.verify();
31  	}
32  	
33  	public void testLoggerWithException() throws Exception, Throwable {
34  		
35  		Mock invocation = new Mock(Invocation.class);
36  		invocation.expectAndReturn("toString", "blah");
37  		invocation.expectAndReturn("proceed", new Exception("MyTestCaseException"));
38  		
39  		TracingInterceptor logger =new TracingInterceptor(true);
40  		
41  		try {
42  			logger.invoke((Invocation) invocation.proxy());
43  		} catch (Exception ex) {
44  			
45  		}
46  		invocation.verify();
47  	}
48  	
49  	public class TestClass {
50  		public void doStuff() { };
51  	}
52  
53  }