01: package abbot.tester;
02:
03: import javax.swing.*;
04: import junit.extensions.abbot.*;
05:
06: /** Unit test to verify the JSpinnerTester class.<p> */
07:
08: public class JSpinnerTesterTest extends ComponentTestFixture {
09:
10: public void testIncrement() {
11: showFrame(numeric);
12: tester.actionIncrement(numeric);
13: assertEquals("Wrong value", new Integer(1), numeric.getValue());
14: }
15:
16: public void testDecrement() {
17: showFrame(numeric);
18: tester.actionDecrement(numeric);
19: assertEquals("Wrong value", new Integer(-1), numeric.getValue());
20: }
21:
22: public void testSetValue() {
23: int VALUE = 199;
24: showFrame(numeric);
25: tester.actionSetValue(numeric, String.valueOf(VALUE));
26: assertEquals("Wrong value", new Integer(VALUE), numeric
27: .getValue());
28: }
29:
30: /** Create a new test case with the given name. */
31: public JSpinnerTesterTest(String name) {
32: super (name);
33: }
34:
35: private JSpinnerTester tester;
36: private JSpinner numeric;
37:
38: protected void setUp() {
39: tester = (JSpinnerTester) ComponentTester
40: .getTester(JSpinner.class);
41: numeric = new JSpinner();
42: numeric.setValue(new Integer(0));
43: }
44:
45: public static void main(String[] args) {
46: RepeatHelper.runTests(args, JSpinnerTesterTest.class);
47: }
48: }
|