KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > inversoft > beans > test > ListenerHelper


1 /*
2  * Copyright (c) 2003, Inversoft
3  *
4  * This software is distribuable under the GNU Lesser General Public License.
5  * For more information visit gnu.org.
6  */

7 package com.inversoft.beans.test;
8
9
10 import junit.framework.TestCase;
11
12 import com.inversoft.beans.ConversionEvent;
13 import com.inversoft.beans.ConversionListener;
14 import com.inversoft.beans.PropertyEvent;
15 import com.inversoft.beans.PropertyListener;
16
17
18 /**
19  * This class is a helper for the listener tests so that the
20  * tests check to be certain that only the handle methods
21  * that are expected are called.
22  *
23  * @author Brian Pontarelli
24  */

25 public class ListenerHelper extends TestCase
26 implements PropertyListener, ConversionListener {
27
28     public ListenerHelper() {
29         super("com.inversoft.beans.test.ListenerHelper");
30     }
31
32     public ListenerHelper(String JavaDoc name) {
33         super(name);
34     }
35
36     /**
37      * This handle method is called when the property value is being retrieved
38      * by calling the getter for the property. This method always calls fail
39      */

40     public void handleGet(PropertyEvent event) {
41         fail("Should not have called the handleGet method");
42     }
43
44     /**
45      * This handle method is called when the property value is being changed
46      * by calling the setter for the property. This method always calls fail
47      */

48     public void handleSet(PropertyEvent event) {
49         fail("Should not have called the handleSet method");
50     }
51
52     /**
53      * This handle method is called when the property value being set is going
54      * to be auto-converted but has not been converted yet. This method always calls fail
55      */

56     public void handlePreConversion(ConversionEvent event) {
57         fail("Should not have called the handlePreConversion method");
58     }
59
60     /**
61      * This handle method is called when the property value being set has just been
62      * successfully auto-converted. This method always calls fail
63      */

64     public void handlePostConversion(ConversionEvent event) {
65         fail("Should not have called the handlePostConversion method");
66     }
67
68     /**
69      * This handle method is called when the property value being set has been
70      * converted and the conversion failed. This method always calls fail
71      */

72     public void handleFailedConversion(ConversionEvent event) {
73         fail("Should not have called the handleFailedConversion method");
74     }
75 }
76
Popular Tags