KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tirsen > nanning > IntfImpl


1 /*
2  * Nanning Aspects
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package com.tirsen.nanning;
8
9 import java.io.Serializable JavaDoc;
10
11 import junit.framework.Assert;
12
13 /**
14  * TODO document Impl
15  *
16  * <!-- $Id: IntfImpl.java,v 1.1 2003/05/09 14:57:49 lecando Exp $ -->
17  *
18  * @author $Author: lecando $
19  * @version $Revision: 1.1 $
20  */

21 public class IntfImpl implements Intf, Serializable JavaDoc {
22     private boolean called;
23     private Object JavaDoc expectThis;
24     private Object JavaDoc actualThis;
25
26     public void expectThis(Object JavaDoc expectThis) {
27         this.expectThis = expectThis;
28     }
29
30     public void call() {
31         called = true;
32         actualThis = Aspects.getThis();
33     }
34
35     public void verify() {
36         Assert.assertTrue(called);
37         if (expectThis != null) {
38             Assert.assertSame(expectThis, actualThis);
39         }
40     }
41 }
42
Popular Tags