KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > config > schema > dynamic > MockConfigItemListener


1 /**
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.config.schema.dynamic;
5
6 /**
7  * Unit test for {@link ConfigItemListener}.
8  */

9 public class MockConfigItemListener implements ConfigItemListener {
10
11   private int numValueChangeds;
12   private Object JavaDoc lastOldValue;
13   private Object JavaDoc lastNewValue;
14
15   public MockConfigItemListener() {
16     reset();
17   }
18
19   public void reset() {
20     this.numValueChangeds = 0;
21     this.lastOldValue = null;
22     this.lastNewValue = null;
23   }
24
25   public void valueChanged(Object JavaDoc oldValue, Object JavaDoc newValue) {
26     ++this.numValueChangeds;
27     this.lastOldValue = oldValue;
28     this.lastNewValue = newValue;
29   }
30
31   public Object JavaDoc getLastNewValue() {
32     return lastNewValue;
33   }
34
35   public Object JavaDoc getLastOldValue() {
36     return lastOldValue;
37   }
38
39   public int getNumValueChangeds() {
40     return numValueChangeds;
41   }
42
43 }
44
Popular Tags