harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r479240 [8/28] - /harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/
Date Sun, 26 Nov 2006 00:04:16 GMT
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/InputMapTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/InputMapTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/InputMapTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/InputMapTest.java Sat Nov 25 16:04:10 2006
@@ -30,14 +30,14 @@
 import java.io.ObjectOutputStream;
 
 public class InputMapTest extends SwingTestCase {
-
     protected InputMap map;
+
     protected InputMap parent;
 
     protected boolean find(final Object[] array, final Object value) {
         boolean found = false;
         if (array != null) {
-            for (int i = 0; i < array.length; i++ ){
+            for (int i = 0; i < array.length; i++) {
                 if (array[i].equals(value)) {
                     found = true;
                     break;
@@ -50,6 +50,7 @@
     /*
      * @see TestCase#setUp()
      */
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         map = new InputMap();
@@ -59,17 +60,14 @@
     public void testPut() {
         KeyStroke keyStroke1 = KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0);
         KeyStroke keyStroke2 = KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0);
-
         map.put(keyStroke1, "1");
         map.put(keyStroke2, "2");
         assertTrue(map.get(keyStroke1).equals("1"));
         assertTrue(map.get(keyStroke2).equals("2"));
-
         map.put(keyStroke2, "1");
         map.put(keyStroke1, "2");
         assertTrue(map.get(keyStroke1).equals("2"));
         assertTrue(map.get(keyStroke2).equals("1"));
-
         map.put(keyStroke1, null);
         map.put(keyStroke2, null);
         assertTrue(map.size() == 0);
@@ -78,34 +76,25 @@
     public void testGet() {
         KeyStroke keyStroke1 = KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0);
         KeyStroke keyStroke2 = KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0);
-
         assertNull(map.get(keyStroke1));
         assertNull(map.get(keyStroke2));
-
         map.put(keyStroke1, "1");
         map.put(keyStroke2, "1");
         assertTrue(map.get(keyStroke1).equals("1"));
         assertTrue(map.get(keyStroke2).equals("1"));
-
         map.put(keyStroke2, "2");
         assertTrue(map.get(keyStroke2).equals("2"));
-
         map.put(keyStroke2, null);
         assertNull(map.get(keyStroke2));
-
-
         InputMap childMap = new InputMap();
         childMap.setParent(map);
-
         map.put(keyStroke1, "1");
         KeyStroke keyStroke11 = KeyStroke.getKeyStroke(KeyEvent.VK_1, 0);
         childMap.put(keyStroke11, "1");
         assertTrue(childMap.get(keyStroke11).equals("1"));
         assertTrue(childMap.get(keyStroke1).equals("1"));
-
         map.put(keyStroke2, "2");
         assertTrue(childMap.get(keyStroke2).equals("2"));
-
         childMap.put(keyStroke2, "1");
         assertTrue(childMap.get(keyStroke2).equals("1"));
     }
@@ -113,16 +102,13 @@
     public void testRemove() {
         KeyStroke keyStroke1 = KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0);
         KeyStroke keyStroke2 = KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0);
-
         map.put(keyStroke1, "1");
         map.put(keyStroke2, "2");
         assertTrue(map.get(keyStroke1).equals("1"));
         assertTrue(map.get(keyStroke2).equals("2"));
-
         map.remove(keyStroke1);
         assertNull(map.get(keyStroke1));
         assertTrue(map.get(keyStroke2).equals("2"));
-
         map.remove(keyStroke2);
         assertNull(map.get(keyStroke2));
         assertTrue(map.size() == 0);
@@ -134,7 +120,6 @@
         KeyStroke keyStroke3 = KeyStroke.getKeyStroke(KeyEvent.VK_1, 0);
         KeyStroke keyStroke4 = KeyStroke.getKeyStroke(KeyEvent.VK_0, 0);
         Object[] keys = map.keys();
-
         assertEquals(0, map.size());
         if (isHarmony()) {
             assertNotNull(keys);
@@ -142,19 +127,16 @@
         } else {
             assertNull(keys);
         }
-
         map.put(keyStroke1, "1");
         map.put(keyStroke2, "2");
         map.put(keyStroke3, "1");
         map.put(keyStroke4, "2");
         keys = map.keys();
-
         assertTrue("array size's correct ", keys != null && keys.length == 4);
         assertTrue(find(keys, keyStroke1));
         assertTrue(find(keys, keyStroke2));
         assertTrue(find(keys, keyStroke3));
         assertTrue(find(keys, keyStroke4));
-
         map.put(keyStroke1, null);
         map.put(keyStroke2, null);
         map.put(keyStroke3, null);
@@ -171,7 +153,6 @@
         KeyStroke keyStroke5 = KeyStroke.getKeyStroke(KeyEvent.VK_5, 0);
         KeyStroke keyStroke6 = KeyStroke.getKeyStroke(KeyEvent.VK_6, 0);
         Object[] keys = map.allKeys();
-
         map.setParent(parent);
         assertEquals(0, map.size());
         if (isHarmony()) {
@@ -180,17 +161,14 @@
         } else {
             assertNull(keys);
         }
-
         parent.put(keyStroke1, "1");
         parent.put(keyStroke2, "2");
         parent.put(keyStroke3, "1");
         parent.put(keyStroke4, "2");
-
         map.put(keyStroke3, "1");
         map.put(keyStroke4, "2");
         map.put(keyStroke5, "1");
         map.put(keyStroke6, "2");
-
         keys = map.allKeys();
         assertTrue(find(keys, keyStroke1));
         assertTrue(find(keys, keyStroke2));
@@ -204,15 +182,11 @@
         InputMap parent1 = new InputMap();
         InputMap parent2 = new InputMap();
         InputMap parent3 = null;
-
         assertNull(map.getParent());
-
         map.setParent(parent1);
         assertTrue(map.getParent() == parent1);
-
         map.setParent(parent3);
         assertTrue(map.getParent() == parent3);
-
         map.setParent(parent2);
         assertTrue(map.getParent() == parent2);
     }
@@ -220,18 +194,14 @@
     public void testClear() {
         KeyStroke keyStroke1 = KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0);
         KeyStroke keyStroke2 = KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0);
-
         assertTrue(map.size() == 0);
-
         map.put(keyStroke1, "1");
         map.put(keyStroke2, "2");
         assertTrue(map.size() == 2);
-
         map.clear();
         assertTrue(map.size() == 0);
         assertTrue("keys", map.keys() != null);
         assertTrue("keys", map.keys().length == 0);
-
         map.put(keyStroke1, "1");
         assertTrue(map.size() == 1);
     }
@@ -241,17 +211,13 @@
         KeyStroke keyStroke2 = KeyStroke.getKeyStroke(KeyEvent.VK_2, 0);
         KeyStroke keyStroke3 = KeyStroke.getKeyStroke(KeyEvent.VK_3, 0);
         KeyStroke keyStroke4 = KeyStroke.getKeyStroke(KeyEvent.VK_4, 0);
-
         assertTrue(map.size() == 0);
-
         map.put(keyStroke1, "1");
         map.put(keyStroke2, "2");
         assertTrue(map.size() == 2);
-
         map.put(keyStroke3, "1");
         map.put(keyStroke4, "2");
         assertTrue(map.size() == 4);
-
         map.put(keyStroke1, null);
         map.put(keyStroke2, null);
         assertTrue(map.size() == 2);
@@ -277,11 +243,11 @@
         ObjectOutputStream so = new ObjectOutputStream(output);
         so.writeObject(map);
         so.flush();
-        ObjectInputStream si = new ObjectInputStream(new ByteArrayInputStream(output.toByteArray()));
-        InputMap ressurectedMap = (InputMap)si.readObject();
+        ObjectInputStream si = new ObjectInputStream(new ByteArrayInputStream(output
+                .toByteArray()));
+        InputMap ressurectedMap = (InputMap) si.readObject();
         assertTrue(ressurectedMap.getParent() != null);
         assertTrue(ressurectedMap.get(keyStroke1).equals(object1));
         assertTrue(ressurectedMap.get(keyStroke2).equals(object2));
     }
-
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/InternalFrameFocusTraversalPolicyTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/InternalFrameFocusTraversalPolicyTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/InternalFrameFocusTraversalPolicyTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/InternalFrameFocusTraversalPolicyTest.java Sat Nov 25 16:04:10 2006
@@ -18,39 +18,41 @@
  * @author Vadim L. Bogdanov
  * @version $Revision$
  */
-
 package javax.swing;
 
 import java.awt.Container;
 import java.awt.Component;
 
 public class InternalFrameFocusTraversalPolicyTest extends SwingTestCase {
-
     /*
      * InternalFrameFocusTraversalPolicy is an abstract class.
      * This class implements its abstract methods.
      */
-    private class TestInternalFrameFocusTraversalPolicy
-            extends InternalFrameFocusTraversalPolicy {
-
+    private class TestInternalFrameFocusTraversalPolicy extends
+            InternalFrameFocusTraversalPolicy {
+        @Override
         public Component getComponentAfter(final Container aContainer,
                 final Component aComponent) {
             return null;
         }
 
+        @Override
         public Component getComponentBefore(final Container aContainer,
                 final Component aComponent) {
             return null;
         }
 
+        @Override
         public Component getFirstComponent(final Container aContainer) {
             return null;
         }
 
+        @Override
         public Component getLastComponent(final Container aContainer) {
             return null;
         }
 
+        @Override
         public Component getDefaultComponent(final Container aContainer) {
             if (aContainer == null) {
                 throw new IllegalArgumentException();
@@ -68,9 +70,9 @@
     /*
      * @see TestCase#setUp()
      */
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
-
         policy = new TestInternalFrameFocusTraversalPolicy();
         frame = new JInternalFrame();
     }
@@ -78,6 +80,7 @@
     /*
      * @see TestCase#tearDown()
      */
+    @Override
     protected void tearDown() throws Exception {
         super.tearDown();
     }
@@ -102,21 +105,19 @@
     public void testGetInitialComponent() {
         // no components in the frame, shold return null
         assertNull("null", policy.getInitialComponent(frame));
-
         // test with 'null' parameter
         boolean ok = false;
         try {
-            policy.getInitialComponent((JInternalFrame)null);
+            policy.getInitialComponent((JInternalFrame) null);
         } catch (IllegalArgumentException e) {
             ok = true;
         } finally {
             assertTrue("exception", ok);
         }
-
         // there are components
         mostRecentFocusOwner = new JPanel();
         frame.getContentPane().add(mostRecentFocusOwner);
-        assertTrue("mostRecentFocusOwner", policy.getInitialComponent(frame) ==
-                mostRecentFocusOwner);
+        assertTrue("mostRecentFocusOwner",
+                policy.getInitialComponent(frame) == mostRecentFocusOwner);
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JButtonTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JButtonTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JButtonTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JButtonTest.java Sat Nov 25 16:04:10 2006
@@ -23,20 +23,18 @@
 package javax.swing;
 
 import java.awt.event.ActionEvent;
-
 import javax.accessibility.AccessibleRole;
 import javax.swing.plaf.ButtonUI;
 
 public class JButtonTest extends AbstractButtonTest {
-
     protected JButton jbutton;
 
     /*
      * @see TestCase#setUp()
      */
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
-
         jbutton = new JButton();
         button = jbutton;
     }
@@ -44,6 +42,7 @@
     /*
      * @see TestCase#tearDown()
      */
+    @Override
     protected void tearDown() throws Exception {
         super.tearDown();
     }
@@ -75,7 +74,7 @@
     public void testJButtonAction() {
         final String command = "dnammoc";
         class MyAction extends AbstractAction {
-            public boolean performed = false;
+            private static final long serialVersionUID = 1L;
 
             public MyAction(final String text, final Icon icon) {
                 super(text, icon);
@@ -83,41 +82,36 @@
             }
 
             public void actionPerformed(final ActionEvent e) {
-                performed = true;
             }
-        };
+        }
+        ;
         Icon icon = createNewIcon();
         String text = "texttext";
         MyAction action = new MyAction(text, icon);
         button = new JButton(action);
-
         assertEquals("icon ", icon, button.getIcon());
         assertEquals("text ", text, button.getText());
         assertEquals("action", action, button.getAction());
         assertEquals("command ", command, button.getActionCommand());
         assertFalse("selected ", button.isSelected());
         assertTrue("enabled ", button.isEnabled());
-
         action.setEnabled(false);
         button = new JButton(action);
-
         assertEquals("icon ", icon, button.getIcon());
         assertEquals("text ", text, button.getText());
         assertEquals("action", action, button.getAction());
         assertEquals("command ", command, button.getActionCommand());
         assertFalse("selected ", button.isSelected());
         assertFalse("enabled ", button.isEnabled());
-
-        button = new JButton((Action)null);
-
+        button = new JButton((Action) null);
         assertNull("icon ", button.getIcon());
         assertNull("text ", button.getText());
         assertNull("action", button.getAction());
         assertNull("command ", button.getActionCommand());
         assertFalse("selected ", button.isSelected());
         assertTrue("enabled ", button.isEnabled());
-
-        assertTrue("button model is of the proper type", button.getModel() instanceof DefaultButtonModel);
+        assertTrue("button model is of the proper type",
+                button.getModel() instanceof DefaultButtonModel);
     }
 
     /*
@@ -140,16 +134,18 @@
     }
 
     public void testGetAccessibleContext() {
-        boolean assertedValue = (jbutton.getAccessibleContext() != null &&
-                jbutton.getAccessibleContext().getClass().getName().equals("javax.swing.JButton$AccessibleJButton"));
-
-        assertTrue("AccessibleContext created properly ",  assertedValue);
-        assertEquals("AccessibleRole", AccessibleRole.PUSH_BUTTON, jbutton.getAccessibleContext().getAccessibleRole());
+        boolean assertedValue = (jbutton.getAccessibleContext() != null && jbutton
+                .getAccessibleContext().getClass().getName().equals(
+                        "javax.swing.JButton$AccessibleJButton"));
+        assertTrue("AccessibleContext created properly ", assertedValue);
+        assertEquals("AccessibleRole", AccessibleRole.PUSH_BUTTON, jbutton
+                .getAccessibleContext().getAccessibleRole());
     }
 
     /*
      * Class under test for String paramString()
      */
+    @Override
     public void testParamString() {
         assertTrue("ParamString returns a string ", jbutton.toString() != null);
     }
@@ -161,7 +157,6 @@
         pane.getContentPane().add(new JButton());
         pane.setDefaultButton(jbutton);
         assertTrue("'ve become defaultButton now ", jbutton.isDefaultButton());
-
         jbutton.removeNotify();
         assertFalse("is not defaultButton now ", jbutton.isDefaultButton());
         assertNull("rootPane now 've no default jbutton ", pane.getDefaultButton());
@@ -171,13 +166,12 @@
         assertEquals("UI class ID", "ButtonUI", jbutton.getUIClassID());
     }
 
+    @Override
     public void testUpdateUI() {
         ButtonUI ui = new ButtonUI() {
         };
-
         jbutton.setUI(ui);
         assertEquals(ui, jbutton.getUI());
-
         jbutton.updateUI();
         assertNotSame(ui, jbutton.getUI());
     }
@@ -191,23 +185,24 @@
         String text1 = "texttext1";
         String text2 = "texttext2";
         AbstractAction action1 = new AbstractAction(text1, icon1) {
+            private static final long serialVersionUID = 1L;
+
             public void actionPerformed(final ActionEvent event) {
             }
         };
         AbstractAction action2 = new AbstractAction(text2, icon2) {
+            private static final long serialVersionUID = 1L;
+
             public void actionPerformed(final ActionEvent event) {
             }
         };
         jbutton.configurePropertiesFromAction(action1);
         assertEquals("icon ", icon1, jbutton.getIcon());
         assertEquals("text ", text1, jbutton.getText());
-
         jbutton.configurePropertiesFromAction(action2);
         assertEquals("icon ", icon2, jbutton.getIcon());
         assertEquals("text ", text2, jbutton.getText());
-
         jbutton.configurePropertiesFromAction(null);
-
         assertNull("icon ", jbutton.getIcon());
         assertNull("text ", jbutton.getText());
         assertNull("action", jbutton.getAction());
@@ -219,13 +214,11 @@
     public void testSetDefaultCapable() {
         jbutton.setDefaultCapable(false);
         assertFalse("DefaultCapable", jbutton.isDefaultCapable());
-
         PropertyChangeController listener = new PropertyChangeController();
         jbutton.addPropertyChangeListener(listener);
         jbutton.setDefaultCapable(true);
         assertTrue("DefaultCapable", jbutton.isDefaultCapable());
         listener.checkPropertyFired(jbutton, "defaultCapable", Boolean.FALSE, Boolean.TRUE);
-
         jbutton.setDefaultCapable(false);
         assertFalse("DefaultCapable", jbutton.isDefaultCapable());
         listener.checkPropertyFired(jbutton, "defaultCapable", Boolean.TRUE, Boolean.FALSE);
@@ -247,77 +240,79 @@
 
     public void testWriteObject() {
         /*
-        String text1 = "can you read betwwen the lines?";
-        String text2 = "can you look through the time?";
-        JButton button1 = new JButton(text1);
-        JButton button2 = new JButton(text2);
-        try {
-            FileOutputStream fo = new FileOutputStream("tmp");
-            ObjectOutputStream so = new ObjectOutputStream(fo);
-            so.writeObject(button1);
-            so.flush();
-        } catch (Exception e) {
-            System.out.println(e);
-            fail("serialization failed");
-        }
-        try {
-            FileOutputStream fo = new FileOutputStream("tmp");
-            ObjectOutputStream so = new ObjectOutputStream(fo);
-            so.writeObject(button2);
-            so.flush();
-        } catch (Exception e) {
-            fail("serialization failed");
-        }
-        */
+         String text1 = "can you read betwwen the lines?";
+         String text2 = "can you look through the time?";
+         JButton button1 = new JButton(text1);
+         JButton button2 = new JButton(text2);
+         try {
+         FileOutputStream fo = new FileOutputStream("tmp");
+         ObjectOutputStream so = new ObjectOutputStream(fo);
+         so.writeObject(button1);
+         so.flush();
+         } catch (Exception e) {
+         System.out.println(e);
+         fail("serialization failed");
+         }
+         try {
+         FileOutputStream fo = new FileOutputStream("tmp");
+         ObjectOutputStream so = new ObjectOutputStream(fo);
+         so.writeObject(button2);
+         so.flush();
+         } catch (Exception e) {
+         fail("serialization failed");
+         }
+         */
     }
 
     public void testReadObject() {
         /*
-        String text1 = "can you read betwwen the lines?";
-        String text2 = "can you look through the time?";
-        JButton button1 = new JButton(text1);
-        JButton button2 = new JButton(text2);
-        try {
-            FileOutputStream fo = new FileOutputStream("tmp");
-            ObjectOutputStream so = new ObjectOutputStream(fo);
-            so.writeObject(button1);
-            so.flush();
-        } catch (Exception e) {
-            fail("serialization failed");
-        }
-        try {
-            FileInputStream fi = new FileInputStream("tmp");
-            ObjectInputStream si = new ObjectInputStream(fi);
-            JButton ressurectedButton = (JButton)si.readObject();
-            assertEquals("text ", text1, ressurectedButton.getText());
-        } catch (Exception e) {
-            fail("deserialization failed");
-        }
-
-        try {
-            FileOutputStream fo = new FileOutputStream("tmp");
-            ObjectOutputStream so = new ObjectOutputStream(fo);
-            so.writeObject(button2);
-            so.flush();
-        } catch (Exception e) {
-            fail("serialization failed");
-        }
-        try {
-            FileInputStream fi = new FileInputStream("tmp");
-            ObjectInputStream si = new ObjectInputStream(fi);
-            JButton ressurectedButton = (JButton)si.readObject();
-            assertEquals("text ", text2, ressurectedButton.getText());
-        } catch (Exception e) {
-            fail("deserialization failed");
-        }
-        */
+         String text1 = "can you read betwwen the lines?";
+         String text2 = "can you look through the time?";
+         JButton button1 = new JButton(text1);
+         JButton button2 = new JButton(text2);
+         try {
+         FileOutputStream fo = new FileOutputStream("tmp");
+         ObjectOutputStream so = new ObjectOutputStream(fo);
+         so.writeObject(button1);
+         so.flush();
+         } catch (Exception e) {
+         fail("serialization failed");
+         }
+         try {
+         FileInputStream fi = new FileInputStream("tmp");
+         ObjectInputStream si = new ObjectInputStream(fi);
+         JButton ressurectedButton = (JButton)si.readObject();
+         assertEquals("text ", text1, ressurectedButton.getText());
+         } catch (Exception e) {
+         fail("deserialization failed");
+         }
+
+         try {
+         FileOutputStream fo = new FileOutputStream("tmp");
+         ObjectOutputStream so = new ObjectOutputStream(fo);
+         so.writeObject(button2);
+         so.flush();
+         } catch (Exception e) {
+         fail("serialization failed");
+         }
+         try {
+         FileInputStream fi = new FileInputStream("tmp");
+         ObjectInputStream si = new ObjectInputStream(fi);
+         JButton ressurectedButton = (JButton)si.readObject();
+         assertEquals("text ", text2, ressurectedButton.getText());
+         } catch (Exception e) {
+         fail("deserialization failed");
+         }
+         */
     }
 
+    @Override
     public void testGetAlignmentXY() {
         assertEquals("alignmentX ", button.getAlignmentX(), 0f, 1e-5);
         assertEquals("alignmentY ", button.getAlignmentY(), 0.5f, 1e-5);
     }
 
+    @Override
     public void testGetUI() {
         assertTrue("ui is returned ", button.getUI() != null);
     }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JCheckBoxMenuItemTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JCheckBoxMenuItemTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JCheckBoxMenuItemTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JCheckBoxMenuItemTest.java Sat Nov 25 16:04:10 2006
@@ -15,24 +15,24 @@
  *  limitations under the License.
  */
 /**
-* @author Alexander T. Simbirtsev
-* @version $Revision$
-*/
+ * @author Alexander T. Simbirtsev
+ * @version $Revision$
+ */
 package javax.swing;
 
 import java.awt.event.ActionEvent;
-
 import javax.accessibility.AccessibleRole;
 import javax.swing.JToggleButton.ToggleButtonModel;
 
 public class JCheckBoxMenuItemTest extends JMenuItemTest {
-
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         menuItem = new JCheckBoxMenuItem();
         button = menuItem;
     }
 
+    @Override
     protected void tearDown() throws Exception {
         super.tearDown();
     }
@@ -46,7 +46,6 @@
         assertNull("icon ", button.getIcon());
         assertEquals("text ", "", button.getText());
         assertFalse("default FocusPainted", menuItem.isFocusPainted());
-
         assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
         assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
         assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
@@ -63,7 +62,6 @@
         assertEquals("icon ", icon, menuItem.getIcon());
         assertEquals("text ", "", menuItem.getText());
         assertFalse("default FocusPainted", menuItem.isFocusPainted());
-
         assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
         assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
         assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
@@ -80,7 +78,6 @@
         assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
         assertNull("icon ", menuItem.getIcon());
         assertEquals("text ", text, menuItem.getText());
-
         assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
         assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
         assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
@@ -99,7 +96,6 @@
         assertEquals("icon ", icon, menuItem.getIcon());
         assertEquals("text ", text, menuItem.getText());
         assertFalse("default FocusPainted", menuItem.isFocusPainted());
-
         assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
         assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
         assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
@@ -113,7 +109,7 @@
         final String command = "dnammoc";
         final KeyStroke accelerator = KeyStroke.getKeyStroke('a');
         class MyAction extends AbstractAction {
-            public boolean performed = false;
+            private static final long serialVersionUID = 1L;
 
             public MyAction(final String text, final Icon icon) {
                 super(text, icon);
@@ -122,15 +118,14 @@
             }
 
             public void actionPerformed(final ActionEvent e) {
-                performed = true;
             }
-        };
+        }
+        ;
         Icon icon = createNewIcon();
         String text = "texttext";
         MyAction action = new MyAction(text, icon);
         menuItem = new JCheckBoxMenuItem(action);
         assertFalse(menuItem.isSelected());
-
         assertEquals("icon ", icon, menuItem.getIcon());
         assertEquals("text ", text, menuItem.getText());
         assertEquals("action", action, menuItem.getAction());
@@ -138,10 +133,8 @@
         assertFalse("selected ", menuItem.isSelected());
         assertTrue("enabled ", menuItem.isEnabled());
         assertEquals("accelerator ", accelerator, menuItem.getAccelerator());
-
         action.setEnabled(false);
         menuItem = new JCheckBoxMenuItem(action);
-
         assertEquals("icon ", icon, menuItem.getIcon());
         assertEquals("text ", text, menuItem.getText());
         assertEquals("action", action, menuItem.getAction());
@@ -149,18 +142,14 @@
         assertFalse("selected ", menuItem.isSelected());
         assertFalse("enabled ", menuItem.isEnabled());
         assertFalse("default FocusPainted", menuItem.isFocusPainted());
-
-        menuItem = new JCheckBoxMenuItem((Action)null);
-
+        menuItem = new JCheckBoxMenuItem((Action) null);
         assertNull("icon ", menuItem.getIcon());
         assertNull("text ", menuItem.getText());
         assertNull("action", menuItem.getAction());
         assertNull("command ", menuItem.getActionCommand());
         assertFalse("selected ", menuItem.isSelected());
         assertTrue("enabled ", menuItem.isEnabled());
-
         assertTrue("default buttonModel ", button.getModel() instanceof ToggleButtonModel);
-
         assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
         assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
         assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
@@ -179,12 +168,10 @@
         assertEquals("text ", text, menuItem.getText());
         assertFalse("default FocusPainted", menuItem.isFocusPainted());
         assertTrue(menuItem.isSelected());
-
         assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
         assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
         assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
         assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
-
         menuItem = new JCheckBoxMenuItem(text, icon, false);
         assertFalse(menuItem.isSelected());
     }
@@ -192,18 +179,20 @@
     /*
      * Test method for 'javax.swing.JCheckBoxMenuItem.getAccessibleContext()'
      */
+    @Override
     public void testGetAccessibleContext() {
-        boolean assertedValue = (menuItem.getAccessibleContext() != null &&
-                menuItem.getAccessibleContext().getClass().getName().
-                equals("javax.swing.JCheckBoxMenuItem$AccessibleJCheckBoxMenuItem"));
-
-        assertTrue("AccessibleContext created properly ",  assertedValue);
-        assertEquals("AccessibleRole", AccessibleRole.CHECK_BOX, menuItem.getAccessibleContext().getAccessibleRole());
+        boolean assertedValue = (menuItem.getAccessibleContext() != null && menuItem
+                .getAccessibleContext().getClass().getName().equals(
+                        "javax.swing.JCheckBoxMenuItem$AccessibleJCheckBoxMenuItem"));
+        assertTrue("AccessibleContext created properly ", assertedValue);
+        assertEquals("AccessibleRole", AccessibleRole.CHECK_BOX, menuItem
+                .getAccessibleContext().getAccessibleRole());
     }
 
     /*
      * Test method for 'javax.swing.JCheckBoxMenuItem.getUIClassID()'
      */
+    @Override
     public void testGetUIClassID() {
         assertEquals("CheckBoxMenuItemUI", menuItem.getUIClassID());
     }
@@ -211,30 +200,27 @@
     /*
      * Test method for 'javax.swing.JCheckBoxMenuItem.getSelectedObjects()'
      */
+    @Override
     public void testGetSelectedObjects() {
         String text = "texttext";
         menuItem = new JCheckBoxMenuItem(text);
-        assertNull(((JCheckBoxMenuItem)menuItem).getSelectedObjects());
-
+        assertNull(((JCheckBoxMenuItem) menuItem).getSelectedObjects());
         menuItem.setSelected(true);
-        assertEquals(1, ((JCheckBoxMenuItem)menuItem).getSelectedObjects().length);
-        assertEquals(menuItem.getText(), ((JCheckBoxMenuItem)menuItem).getSelectedObjects()[0]);
+        assertEquals(1, ((JCheckBoxMenuItem) menuItem).getSelectedObjects().length);
+        assertEquals(menuItem.getText(), ((JCheckBoxMenuItem) menuItem).getSelectedObjects()[0]);
     }
 
     /*
      * Test method for 'javax.swing.JCheckBoxMenuItem.getState()'
      */
     public void testGetSetState() {
-        assertEquals("default Selected", ((JCheckBoxMenuItem)menuItem).getState(),
-                     menuItem.isSelected());
-
+        assertEquals("default Selected", ((JCheckBoxMenuItem) menuItem).getState(), menuItem
+                .isSelected());
         menuItem.setSelected(true);
-        assertEquals("Selected", ((JCheckBoxMenuItem)menuItem).getState(),
-                     menuItem.isSelected());
-
-        ((JCheckBoxMenuItem)menuItem).setState(false);
-        assertEquals("Selected", ((JCheckBoxMenuItem)menuItem).getState(),
-                     menuItem.isSelected());
+        assertEquals("Selected", ((JCheckBoxMenuItem) menuItem).getState(), menuItem
+                .isSelected());
+        ((JCheckBoxMenuItem) menuItem).setState(false);
+        assertEquals("Selected", ((JCheckBoxMenuItem) menuItem).getState(), menuItem
+                .isSelected());
     }
-
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JCheckBoxTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JCheckBoxTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JCheckBoxTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JCheckBoxTest.java Sat Nov 25 16:04:10 2006
@@ -24,29 +24,28 @@
 
 import java.awt.event.ActionEvent;
 import java.awt.image.BufferedImage;
-
 import javax.accessibility.AccessibleRole;
 import javax.swing.plaf.ButtonUI;
 
 public class JCheckBoxTest extends SwingTestCase {
-
     protected AbstractButton button = null;
 
     /*
      * @see TestCase#setUp()
      */
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
-
         button = new JCheckBox();
     }
 
     public void testGetAccessibleContext() {
-        boolean assertedValue = (button.getAccessibleContext() != null &&
-                button.getAccessibleContext().getClass().getName().equals("javax.swing.JCheckBox$AccessibleJCheckBox"));
-
-        assertTrue("AccessibleContext created properly ",  assertedValue);
-        assertEquals("AccessibleRole", AccessibleRole.CHECK_BOX, button.getAccessibleContext().getAccessibleRole());
+        boolean assertedValue = (button.getAccessibleContext() != null && button
+                .getAccessibleContext().getClass().getName().equals(
+                        "javax.swing.JCheckBox$AccessibleJCheckBox"));
+        assertTrue("AccessibleContext created properly ", assertedValue);
+        assertEquals("AccessibleRole", AccessibleRole.CHECK_BOX, button.getAccessibleContext()
+                .getAccessibleRole());
     }
 
     public void testParamString() {
@@ -60,10 +59,8 @@
     public void testUpdateUI() {
         ButtonUI ui = new ButtonUI() {
         };
-
         button.setUI(ui);
         assertEquals(ui, button.getUI());
-
         button.updateUI();
         assertNotSame(ui, button.getUI());
     }
@@ -72,23 +69,26 @@
         Object res1 = null;
         Object res2 = null;
         AbstractAction action1 = new AbstractAction() {
+            private static final long serialVersionUID = 1L;
+
             public void actionPerformed(final ActionEvent event) {
             }
         };
         AbstractAction action2 = new AbstractAction() {
+            private static final long serialVersionUID = 1L;
+
             public void actionPerformed(final ActionEvent event) {
             }
         };
         res1 = button.createActionPropertyChangeListener(action1);
         assertNotNull("returned value is not null", res1);
-
         res2 = button.createActionPropertyChangeListener(action2);
         assertNotNull("returned value is not null", res2);
-
         res2 = button.createActionPropertyChangeListener(null);
         assertNotNull("returned value is not null", res2);
     }
 
+    @SuppressWarnings("serial")
     public void testConfigurePropertiesFromAction() {
         Icon icon1 = new ImageIcon(new BufferedImage(20, 20, BufferedImage.TYPE_BYTE_GRAY));
         Icon icon2 = new ImageIcon(new BufferedImage(20, 20, BufferedImage.TYPE_BYTE_GRAY));
@@ -108,7 +108,6 @@
         action1.putValue(Action.SHORT_DESCRIPTION, text3);
         action1.putValue(Action.MNEMONIC_KEY, new Integer(1));
         button.setAction(action1);
-
         assertEquals("action ", action1, button.getAction());
         assertTrue("enabled ", button.isEnabled());
         assertTrue("enabled ", action1.isEnabled());
@@ -116,28 +115,23 @@
         button.isEnabled();
         assertFalse("enabled ", button.isEnabled());
         assertFalse("enabled ", action1.isEnabled());
-
         assertNull("icon ", button.getIcon());
         action1.putValue(Action.SMALL_ICON, icon2);
         assertNull("icon ", button.getIcon());
         button.setIcon(icon2);
         action1.putValue(Action.SMALL_ICON, null);
         assertEquals("icon ", icon2, button.getIcon());
-
         if (isHarmony()) {
             assertEquals("mnemonic ", 1, button.getMnemonic());
             action1.putValue(Action.MNEMONIC_KEY, new Integer(27));
             assertEquals("mnemonic ", 27, button.getMnemonic());
         }
-
         assertEquals("text ", text1, button.getText());
         action1.putValue(Action.NAME, text2);
         assertEquals("text ", text2, button.getText());
-
         assertEquals("ToolTipText ", text3, button.getToolTipText());
         action1.putValue(Action.SHORT_DESCRIPTION, text4);
         assertEquals("ToolTipText ", text4, button.getToolTipText());
-
         button.setAction(action2);
         action1.putValue(Action.SHORT_DESCRIPTION, text4);
         assertNull("ToolTipText ", button.getToolTipText());
@@ -159,35 +153,31 @@
     /*
      * Class under test for void JCheckBox(Action)
      */
+    @SuppressWarnings("serial")
     public void testJCheckBoxAction() {
         final String command = "dnammoc";
         class MyAction extends AbstractAction {
-            public boolean performed = false;
-
             public MyAction(final String text, final Icon icon) {
                 super(text, icon);
                 putValue(Action.ACTION_COMMAND_KEY, command);
             }
 
             public void actionPerformed(final ActionEvent e) {
-                performed = true;
             }
-        };
+        }
+        ;
         Icon icon = new ImageIcon(new BufferedImage(20, 20, BufferedImage.TYPE_BYTE_GRAY));
         String text = "texttext";
         MyAction action = new MyAction(text, icon);
         action.setEnabled(false);
         button = new JCheckBox(action);
-
         assertNull("icon ", button.getIcon());
         assertEquals("text ", text, button.getText());
         assertEquals("action", action, button.getAction());
         assertEquals("command ", command, button.getActionCommand());
         assertFalse("selected ", button.isSelected());
         assertFalse("enabled ", button.isEnabled());
-
-        button = new JCheckBox((Action)null);
-
+        button = new JCheckBox((Action) null);
         assertNull("icon ", button.getIcon());
         assertNull("text ", button.getText());
         assertNull("action", button.getAction());
@@ -206,12 +196,10 @@
         String text2 = "";
         boolean state1 = false;
         boolean state2 = false;
-
         button = new JCheckBox(icon1);
         assertEquals("icon ", icon1, button.getIcon());
         assertEquals("text ", text1, button.getText());
         assertEquals("selected ", state1, button.isSelected());
-
         button = new JCheckBox(icon2);
         assertEquals("icon ", icon2, button.getIcon());
         assertEquals("text ", text2, button.getText());
@@ -228,12 +216,10 @@
         String text2 = "";
         boolean state1 = true;
         boolean state2 = false;
-
         button = new JCheckBox(icon1, state1);
         assertEquals("icon ", icon1, button.getIcon());
         assertEquals("text ", text1, button.getText());
         assertEquals("selected ", state1, button.isSelected());
-
         button = new JCheckBox(icon2, state2);
         assertEquals("icon ", icon2, button.getIcon());
         assertEquals("text ", text2, button.getText());
@@ -250,12 +236,10 @@
         String text2 = "texttext2";
         boolean state1 = false;
         boolean state2 = false;
-
         button = new JCheckBox(text1);
         assertEquals("icon ", icon1, button.getIcon());
         assertEquals("text ", text1, button.getText());
         assertEquals("selected ", state1, button.isSelected());
-
         button = new JCheckBox(text2);
         assertEquals("icon ", icon2, button.getIcon());
         assertEquals("text ", text2, button.getText());
@@ -272,12 +256,10 @@
         String text2 = "texttext2";
         boolean state1 = true;
         boolean state2 = false;
-
         button = new JCheckBox(text1, state1);
         assertEquals("icon ", icon1, button.getIcon());
         assertEquals("text ", text1, button.getText());
         assertEquals("selected ", state1, button.isSelected());
-
         button = new JCheckBox(text2, state2);
         assertEquals("icon ", icon2, button.getIcon());
         assertEquals("text ", text2, button.getText());
@@ -294,12 +276,10 @@
         String text2 = "texttext2";
         boolean state1 = false;
         boolean state2 = false;
-
         button = new JCheckBox(text1, icon1);
         assertEquals("icon ", icon1, button.getIcon());
         assertEquals("text ", text1, button.getText());
         assertEquals("selected ", state1, button.isSelected());
-
         button = new JCheckBox(text2, icon2);
         assertEquals("icon ", icon2, button.getIcon());
         assertEquals("text ", text2, button.getText());
@@ -316,12 +296,10 @@
         String text2 = "texttext2";
         boolean state1 = true;
         boolean state2 = false;
-
         button = new JCheckBox(text1, icon1, state1);
         assertEquals("icon ", icon1, button.getIcon());
         assertEquals("text ", text1, button.getText());
         assertEquals("selected ", state1, button.isSelected());
-
         button = new JCheckBox(text2, icon2, state2);
         assertEquals("icon ", icon2, button.getIcon());
         assertEquals("text ", text2, button.getText());
@@ -329,21 +307,18 @@
     }
 
     public void testIsBorderPaintedFlat() {
-        assertFalse("paintedFlat", ((JCheckBox)button).isBorderPaintedFlat());
+        assertFalse("paintedFlat", ((JCheckBox) button).isBorderPaintedFlat());
     }
 
     public void testSetBorderPaintedFlat() {
-        PropertyChangeController listener1 =  new PropertyChangeController();
+        PropertyChangeController listener1 = new PropertyChangeController();
         button.addPropertyChangeListener(listener1);
-
-        ((JCheckBox)button).setBorderPaintedFlat(true);
+        ((JCheckBox) button).setBorderPaintedFlat(true);
         listener1.checkPropertyFired(button, "borderPaintedFlat", Boolean.FALSE, Boolean.TRUE);
-        assertTrue("borderPaintedFlat", ((JCheckBox)button).isBorderPaintedFlat());
+        assertTrue("borderPaintedFlat", ((JCheckBox) button).isBorderPaintedFlat());
         listener1.reset();
-
-        ((JCheckBox)button).setBorderPaintedFlat(false);
+        ((JCheckBox) button).setBorderPaintedFlat(false);
         listener1.checkPropertyFired(button, "borderPaintedFlat", Boolean.TRUE, Boolean.FALSE);
-        assertFalse("borderPaintedFlat", ((JCheckBox)button).isBorderPaintedFlat());
+        assertFalse("borderPaintedFlat", ((JCheckBox) button).isBorderPaintedFlat());
     }
-
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JColorChooserTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JColorChooserTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JColorChooserTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JColorChooserTest.java Sat Nov 25 16:04:10 2006
@@ -15,15 +15,14 @@
  *  limitations under the License.
  */
 /**
-* @author Sergey Burlak
-* @version $Revision$
-*/
+ * @author Sergey Burlak
+ * @version $Revision$
+ */
 package javax.swing;
 
 import java.awt.BorderLayout;
 import java.awt.Color;
 import java.beans.PropertyChangeEvent;
-
 import javax.swing.colorchooser.AbstractColorChooserPanel;
 import javax.swing.colorchooser.ColorChooserComponentFactory;
 import javax.swing.colorchooser.ColorSelectionModel;
@@ -32,34 +31,32 @@
 public class JColorChooserTest extends BasicSwingTestCase {
     private JColorChooser ch;
 
+    @Override
     public void setUp() {
         ch = new JColorChooser();
-
         propertyChangeController = new PropertyChangeController();
         propertyChangeController.setVerbose(false);
         ch.addPropertyChangeListener(propertyChangeController);
     }
 
+    @Override
     protected void tearDown() throws Exception {
         ch = null;
     }
-    
+
     public void testJColorChooser() throws Exception {
         assertSame(DefaultColorSelectionModel.class, ch.getSelectionModel().getClass());
         assertNull(ch.accessibleContext);
         assertEquals(Color.WHITE, ch.getColor());
-        
         ch = new JColorChooser(Color.BLACK);
         assertEquals(Color.BLACK, ch.getColor());
-        
         ColorSelectionModel model = new DefaultColorSelectionModel();
         ch = new JColorChooser(model);
         assertFalse(propertyChangeController.isChanged());
         assertSame(model, ch.getSelectionModel());
-        
         assertSame(BorderLayout.class, ch.getLayout().getClass());
     }
-    
+
     public void testGetAccessibleContext() throws Exception {
         assertNull(ch.accessibleContext);
         assertNotNull(ch.getAccessibleContext());
@@ -68,54 +65,52 @@
         assertSame(ch.accessibleContext, ch.getAccessibleContext());
         assertSame(JColorChooser.AccessibleJColorChooser.class, ch.accessibleContext.getClass());
     }
-    
+
     public void testSetGetSelectionModel() throws Exception {
         assertNotNull(ch.getSelectionModel());
-        ColorSelectionModel oldModel = ch.getSelectionModel(); 
+        ColorSelectionModel oldModel = ch.getSelectionModel();
         ColorSelectionModel model = new DefaultColorSelectionModel();
         ch.setSelectionModel(model);
         assertTrue(propertyChangeController.isChanged(JColorChooser.SELECTION_MODEL_PROPERTY));
-        assertSame(model, ((PropertyChangeEvent)propertyChangeController.getLastEvent()).getNewValue());
-        assertSame(oldModel, ((PropertyChangeEvent)propertyChangeController.getLastEvent()).getOldValue());
-        
+        assertSame(model, ((PropertyChangeEvent) propertyChangeController.getLastEvent())
+                .getNewValue());
+        assertSame(oldModel, ((PropertyChangeEvent) propertyChangeController.getLastEvent())
+                .getOldValue());
         ch.setSelectionModel(null);
         assertNull(ch.getSelectionModel());
     }
-    
+
     public void testSetGetColor() throws Exception {
         ChangeController changeController = new ChangeController();
         ch.getSelectionModel().addChangeListener(changeController);
-        
         assertEquals(Color.WHITE, ch.getColor());
         ch.setColor(Color.RED);
         assertFalse(propertyChangeController.isChanged());
         assertEquals(Color.RED, ch.getColor());
         assertTrue(changeController.isChanged());
-        
         changeController.reset();
         ch.setColor(0, 255, 0);
         assertFalse(propertyChangeController.isChanged());
         assertEquals(Color.GREEN, ch.getColor());
         assertTrue(changeController.isChanged());
-
         changeController.reset();
         ch.setColor(255);
         assertFalse(propertyChangeController.isChanged());
         assertEquals(Color.BLUE, ch.getColor());
         assertTrue(changeController.isChanged());
     }
-    
+
     public void testGetUIClassID() throws Exception {
         assertEquals("ColorChooserUI", ch.getUIClassID());
     }
-    
+
     public void testSetGetDragEnabled() throws Exception {
         assertFalse(ch.getDragEnabled());
         ch.setDragEnabled(true);
         assertFalse(propertyChangeController.isChanged());
         assertTrue(ch.getDragEnabled());
     }
-    
+
     public void testSetGetPreviewPanel() throws Exception {
         ch.addPropertyChangeListener(propertyChangeController);
         assertNotNull(ch.getPreviewPanel());
@@ -123,27 +118,30 @@
         ch.setPreviewPanel(button);
         assertTrue(propertyChangeController.isChanged(JColorChooser.PREVIEW_PANEL_PROPERTY));
         assertSame(button, ch.getPreviewPanel());
-        assertSame(button, ((PropertyChangeEvent)propertyChangeController.getLastEvent()).getNewValue());
-        
+        assertSame(button, ((PropertyChangeEvent) propertyChangeController.getLastEvent())
+                .getNewValue());
         propertyChangeController.reset();
         ch.setPreviewPanel(null);
         assertTrue(propertyChangeController.isChanged(JColorChooser.PREVIEW_PANEL_PROPERTY));
         assertNotNull(ch.getPreviewPanel());
-        assertSame(ColorChooserComponentFactory.getPreviewPanel().getClass(), ch.getPreviewPanel().getClass());
+        assertSame(ColorChooserComponentFactory.getPreviewPanel().getClass(), ch
+                .getPreviewPanel().getClass());
     }
-    
+
     public void testSetGetChooserPanels() throws Exception {
         AbstractColorChooserPanel[] oldChooserPanels = ch.getChooserPanels();
         assertEquals(3, oldChooserPanels.length);
         AbstractColorChooserPanel[] newPanels = new AbstractColorChooserPanel[] {};
         ch.setChooserPanels(newPanels);
         assertTrue(propertyChangeController.isChanged(JColorChooser.CHOOSER_PANELS_PROPERTY));
-        assertSame(newPanels, ((PropertyChangeEvent)propertyChangeController.getLastEvent()).getNewValue());
-        assertSame(oldChooserPanels, ((PropertyChangeEvent)propertyChangeController.getLastEvent()).getOldValue());
+        assertSame(newPanels, ((PropertyChangeEvent) propertyChangeController.getLastEvent())
+                .getNewValue());
+        assertSame(oldChooserPanels, ((PropertyChangeEvent) propertyChangeController
+                .getLastEvent()).getOldValue());
         assertSame(newPanels, ch.getChooserPanels());
         assertEquals(0, ch.getChooserPanels().length);
     }
-    
+
     public void testAddRemoveChooserPanel() throws Exception {
         AbstractColorChooserPanel[] oldChooserPanels = ch.getChooserPanels();
         assertEquals(3, oldChooserPanels.length);
@@ -151,7 +149,6 @@
         assertSame(panel, ch.removeChooserPanel(panel));
         assertTrue(propertyChangeController.isChanged(JColorChooser.CHOOSER_PANELS_PROPERTY));
         assertEquals(2, ch.getChooserPanels().length);
-        
         propertyChangeController.reset();
         try {
             ch.removeChooserPanel(panel);
@@ -160,20 +157,17 @@
         }
         assertFalse(propertyChangeController.isChanged(JColorChooser.CHOOSER_PANELS_PROPERTY));
         assertEquals(2, ch.getChooserPanels().length);
-
         propertyChangeController.reset();
         ch.addChooserPanel(panel);
         assertTrue(propertyChangeController.isChanged(JColorChooser.CHOOSER_PANELS_PROPERTY));
         assertEquals(3, ch.getChooserPanels().length);
         assertSame(panel, ch.getChooserPanels()[2]);
-
         propertyChangeController.reset();
         try {
             ch.addChooserPanel(null);
             fail("NPE shall be thrown");
         } catch (NullPointerException npe) {
         }
-
         propertyChangeController.reset();
         try {
             ch.removeChooserPanel(null);

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComboBoxRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComboBoxRTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComboBoxRTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComboBoxRTest.java Sat Nov 25 16:04:10 2006
@@ -22,7 +22,6 @@
 
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
-
 import junit.framework.TestCase;
 
 public class JComboBoxRTest extends TestCase {
@@ -33,41 +32,38 @@
     }
 
     public void testRemoveAllItems() throws Exception {
-        JComboBox cb = new JComboBox(new String[] {"1", "2", "4"});
+        JComboBox cb = new JComboBox(new String[] { "1", "2", "4" });
         assertEquals(3, cb.getItemCount());
-
         cb.removeAllItems();
         assertEquals(0, cb.getItemCount());
-
         cb.addItem("new");
         assertEquals(1, cb.getItemCount());
     }
 
     public void testKeyboardActionsEnabled() throws Exception {
-        JComboBox cb = new JComboBox(new String[] {"1", "2", "4"});
+        JComboBox cb = new JComboBox(new String[] { "1", "2", "4" });
         checkActionState(cb, "hidePopup", false);
         checkActionState(cb, "enterPressed", true);
         checkActionState(cb, "selectPrevious", true);
-
         checkActionState(cb, "togglePopup", true);
         checkActionState(cb, "spacePopup", true);
     }
 
-
-    private void checkActionState(final JComboBox cb, final String actionName, final boolean expectedState) {
+    private void checkActionState(final JComboBox cb, final String actionName,
+            final boolean expectedState) {
         Action action = cb.getActionMap().get(actionName);
         assertNotNull(action);
         assertEquals(expectedState, action.isEnabled());
     }
-    
+
     public void testSetSelectedItem() {
         // regression test HARMONY-1533
         String item = "item";
-        JComboBox jcb = new JComboBox(new String[]{item});
-        jcb.addActionListener(new ActionListener(){
+        JComboBox jcb = new JComboBox(new String[] { item });
+        jcb.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent ae) {
-                eventFired = true;               
-            }            
+                eventFired = true;
+            }
         });
         jcb.setSelectedItem(item);
         assertTrue("action performed", eventFired);

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComboBoxTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComboBoxTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComboBoxTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComboBoxTest.java Sat Nov 25 16:04:10 2006
@@ -29,15 +29,16 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Vector;
-
 import javax.swing.event.ListDataListener;
 import javax.swing.event.PopupMenuEvent;
 import javax.swing.event.PopupMenuListener;
 import javax.swing.plaf.ComboBoxUI;
 import javax.swing.plaf.basic.BasicComboBoxEditor;
 
+@SuppressWarnings("serial")
 public class JComboBoxTest extends SwingTestCase {
     private JComboBox comboBox;
+
     private JFrame frame;
 
     public JComboBoxTest(final String name) {
@@ -45,12 +46,14 @@
         setIgnoreNotImplemented(true);
     }
 
+    @Override
     protected void setUp() throws Exception {
         comboBox = new JComboBox();
         propertyChangeController = new PropertyChangeController();
         comboBox.addPropertyChangeListener(propertyChangeController);
     }
 
+    @Override
     protected void tearDown() throws Exception {
         comboBox = null;
         propertyChangeController = null;
@@ -64,35 +67,33 @@
         assertNotNull(comboBox.dataModel);
         assertEquals(comboBox.dataModel, comboBox.getModel());
         assertTrue(comboBox.dataModel instanceof DefaultComboBoxModel);
-
         DefaultComboBoxModel newModel = new DefaultComboBoxModel();
         comboBox = new JComboBox(newModel);
         assertEquals(newModel, comboBox.getModel());
-
-        comboBox = new JComboBox(new Object[] {"1", "2", "3"});
+        comboBox = new JComboBox(new Object[] { "1", "2", "3" });
         assertEquals(3, comboBox.getModel().getSize());
-
-        Vector newData = new Vector();
+        Vector<String> newData = new Vector<String>();
         newData.add("1");
         newData.add("2");
         comboBox = new JComboBox(newData);
         assertEquals(2, comboBox.getModel().getSize());
-
         assertFalse(propertyChangeController.isChanged());
     }
 
     public void testSetUI() throws Exception {
         assertNotNull(comboBox.getUI());
-
         ComboBoxUI newUI = new ComboBoxUI() {
+            @Override
             public boolean isFocusTraversable(final JComboBox arg0) {
                 return false;
             }
 
+            @Override
             public boolean isPopupVisible(final JComboBox arg0) {
                 return false;
             }
 
+            @Override
             public void setPopupVisible(final JComboBox arg0, final boolean arg1) {
             }
         };
@@ -110,8 +111,8 @@
         comboBox.setModel(newModel);
         assertEquals(newModel, comboBox.getModel());
         assertTrue(propertyChangeController.isChanged("model"));
-
         testExceptionalCase(new ExceptionalCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 comboBox.setModel(null);
             }
@@ -122,7 +123,6 @@
         assertTrue(comboBox.isLightWeightPopupEnabled());
         comboBox.setLightWeightPopupEnabled(true);
         assertFalse(propertyChangeController.isChanged());
-
         comboBox.setLightWeightPopupEnabled(false);
         assertFalse(comboBox.isLightWeightPopupEnabled());
         assertTrue(propertyChangeController.isChanged("lightWeightPopupEnabled"));
@@ -140,7 +140,6 @@
         comboBox.setMaximumRowCount(-3);
         assertEquals(-3, comboBox.getMaximumRowCount());
         assertTrue(propertyChangeController.isChanged("maximumRowCount"));
-
         propertyChangeController.reset();
         comboBox.setMaximumRowCount(5);
         assertEquals(5, comboBox.getMaximumRowCount());
@@ -149,7 +148,6 @@
 
     public void testGetSetRenderer() throws Exception {
         assertNotNull(comboBox.getRenderer());
-
         DefaultListCellRenderer newRenderer = new DefaultListCellRenderer();
         comboBox.setRenderer(newRenderer);
         assertEquals(newRenderer, comboBox.getRenderer());
@@ -158,12 +156,10 @@
 
     public void testGetSetEditor() throws Exception {
         assertNotNull(comboBox.getEditor());
-
         ComboBoxEditor newEditor = new BasicComboBoxEditor();
         comboBox.setEditor(newEditor);
         assertEquals(newEditor, comboBox.getEditor());
         assertTrue(propertyChangeController.isChanged("editor"));
-
         comboBox.setEditor(null);
         assertNull(comboBox.getEditor());
     }
@@ -173,14 +169,12 @@
         comboBox.addItemListener(itemController);
         ActionController actionController = new ActionController();
         comboBox.addActionListener(actionController);
-
         assertNull(comboBox.getSelectedItem());
         comboBox.setSelectedItem("a");
         assertNull(comboBox.getSelectedItem());
         assertEquals(-1, comboBox.getSelectedIndex());
         assertNull(actionController.getEvent());
         assertTrue(itemController.getEvents().isEmpty());
-
         actionController.reset();
         itemController.reset();
         comboBox.setEditable(true);
@@ -188,22 +182,20 @@
         assertEquals("a", comboBox.getSelectedItem());
         assertEquals(-1, comboBox.getSelectedIndex());
         assertEquals(1, itemController.getEvents().size());
-        assertEquals(ItemEvent.SELECTED, ((ItemEvent)itemController.getEvents().get(0)).getStateChange());
-        assertEquals(ItemEvent.ITEM_STATE_CHANGED, ((ItemEvent)itemController.getEvents().get(0)).getID());
+        assertEquals(ItemEvent.SELECTED, itemController.getEvents().get(0).getStateChange());
+        assertEquals(ItemEvent.ITEM_STATE_CHANGED, itemController.getEvents().get(0).getID());
         assertNotNull(actionController.getEvent());
-
         actionController.reset();
         itemController.reset();
         comboBox.setSelectedItem("b");
         assertEquals("b", comboBox.getSelectedItem());
         assertEquals(-1, comboBox.getSelectedIndex());
         assertEquals(2, itemController.getEvents().size());
-        assertEquals(ItemEvent.DESELECTED, ((ItemEvent)itemController.getEvents().get(0)).getStateChange());
-        assertEquals(ItemEvent.ITEM_STATE_CHANGED, ((ItemEvent)itemController.getEvents().get(0)).getID());
-        assertEquals(ItemEvent.SELECTED, ((ItemEvent)itemController.getEvents().get(1)).getStateChange());
-        assertEquals(ItemEvent.ITEM_STATE_CHANGED, ((ItemEvent)itemController.getEvents().get(1)).getID());
+        assertEquals(ItemEvent.DESELECTED, itemController.getEvents().get(0).getStateChange());
+        assertEquals(ItemEvent.ITEM_STATE_CHANGED, itemController.getEvents().get(0).getID());
+        assertEquals(ItemEvent.SELECTED, itemController.getEvents().get(1).getStateChange());
+        assertEquals(ItemEvent.ITEM_STATE_CHANGED, itemController.getEvents().get(1).getID());
         assertNotNull(actionController.getEvent());
-
         actionController.reset();
         itemController.reset();
         assertEquals("b", comboBox.getSelectedItem());
@@ -214,8 +206,6 @@
         } else {
             assertNotNull(actionController.getEvent());
         }
-
-
         actionController.reset();
         itemController.reset();
         comboBox.setEditable(false);
@@ -227,7 +217,6 @@
         assertEquals(1, comboBox.getSelectedIndex());
         assertNull(actionController.getEvent());
         assertTrue(itemController.getEvents().isEmpty());
-
         assertEquals(1, comboBox.getSelectedIndex());
         comboBox.setSelectedItem("b");
         assertEquals(1, comboBox.getSelectedIndex());
@@ -237,14 +226,11 @@
             assertNotNull(actionController.getEvent());
         }
         assertTrue(itemController.getEvents().isEmpty());
-
-
         comboBox.setSelectedItem("a");
         assertEquals("a", comboBox.getSelectedItem());
         assertEquals(0, comboBox.getSelectedIndex());
         assertNotNull(actionController.getEvent());
         assertEquals(2, itemController.getEvents().size());
-
         comboBox.removeItem("a");
         assertEquals("b", comboBox.getSelectedItem());
         assertEquals(0, comboBox.getSelectedIndex());
@@ -253,41 +239,37 @@
     public void testGetSetSelectedIndex() throws Exception {
         assertEquals(-1, comboBox.getSelectedIndex());
         testExceptionalCase(new IllegalArgumentCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 comboBox.setSelectedIndex(0);
             }
         });
         testExceptionalCase(new IllegalArgumentCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 comboBox.setSelectedIndex(-2);
             }
         });
         comboBox.setSelectedIndex(-1);
         assertEquals(-1, comboBox.getSelectedIndex());
-
         comboBox.addItem("a");
         comboBox.addItem("b");
         assertEquals(0, comboBox.getSelectedIndex());
         assertEquals("a", comboBox.getSelectedItem());
-
         comboBox.setSelectedIndex(0);
         assertEquals(0, comboBox.getSelectedIndex());
         assertEquals("a", comboBox.getSelectedItem());
-
         comboBox.removeItem("a");
         assertEquals(0, comboBox.getSelectedIndex());
         assertEquals("b", comboBox.getSelectedItem());
-
         comboBox.addItem("c");
         comboBox.addItem("d");
         comboBox.addItem("e");
         comboBox.setSelectedItem("d");
         assertEquals(2, comboBox.getSelectedIndex());
-
         comboBox.removeItem("d");
         assertEquals(1, comboBox.getSelectedIndex());
         assertEquals("c", comboBox.getSelectedItem());
-
         comboBox.setEditable(true);
         comboBox.setSelectedItem("f");
         assertEquals(-1, comboBox.getSelectedIndex());
@@ -295,7 +277,6 @@
 
     public void testPrototypeDisplayValue() throws Exception {
         assertNull(comboBox.getPrototypeDisplayValue());
-
         comboBox.setPrototypeDisplayValue("a");
         assertEquals("a", comboBox.getPrototypeDisplayValue());
         assertTrue(propertyChangeController.isChanged("prototypeDisplayValue"));
@@ -306,7 +287,6 @@
         comboBox.addItemListener(itemController);
         ActionController actionController = new ActionController();
         comboBox.addActionListener(actionController);
-
         assertNull(comboBox.getSelectedItem());
         assertEquals(-1, comboBox.getSelectedIndex());
         comboBox.addItem("a");
@@ -315,13 +295,11 @@
         assertNotNull(actionController.getEvent());
         assertEquals("a", comboBox.getSelectedItem());
         assertEquals(0, comboBox.getSelectedIndex());
-
         itemController.reset();
         actionController.reset();
         comboBox.addItem("b");
         assertEquals(0, itemController.getEvents().size());
         assertNull(actionController.getEvent());
-
         ComboBoxModel immutableModel = new ComboBoxModel() {
             public Object getSelectedItem() {
                 return null;
@@ -346,6 +324,7 @@
         };
         comboBox.setModel(immutableModel);
         testExceptionalCase(new ExceptionalCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 comboBox.addItem("a");
             }
@@ -357,7 +336,6 @@
         comboBox.addItemListener(itemController);
         ActionController actionController = new ActionController();
         comboBox.addActionListener(actionController);
-
         assertNull(comboBox.getSelectedItem());
         assertEquals(-1, comboBox.getSelectedIndex());
         comboBox.insertItemAt("a", 0);
@@ -366,13 +344,11 @@
         assertNull(actionController.getEvent());
         assertNull(comboBox.getSelectedItem());
         assertEquals(-1, comboBox.getSelectedIndex());
-
         itemController.reset();
         actionController.reset();
         comboBox.insertItemAt("b", 1);
         assertEquals(0, itemController.getEvents().size());
         assertNull(actionController.getEvent());
-
         ComboBoxModel immutableModel = new ComboBoxModel() {
             public Object getSelectedItem() {
                 return null;
@@ -397,6 +373,7 @@
         };
         comboBox.setModel(immutableModel);
         testExceptionalCase(new ExceptionalCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 comboBox.insertItemAt("c", 0);
             }
@@ -408,11 +385,9 @@
         comboBox.addItemListener(itemController);
         ActionController actionController = new ActionController();
         comboBox.addActionListener(actionController);
-
         comboBox.addItem("a");
         comboBox.addItem("b");
         assertEquals("a", comboBox.getSelectedItem());
-
         itemController.reset();
         actionController.reset();
         comboBox.removeItem("a");
@@ -420,7 +395,6 @@
         assertEquals(1, comboBox.getModel().getSize());
         assertEquals(2, itemController.getEvents().size());
         assertNotNull(actionController.getEvent());
-
         itemController.reset();
         actionController.reset();
         comboBox.removeItem("a");
@@ -434,11 +408,9 @@
         comboBox.addItemListener(itemController);
         ActionController actionController = new ActionController();
         comboBox.addActionListener(actionController);
-
         comboBox.addItem("a");
         comboBox.addItem("b");
         assertEquals("a", comboBox.getSelectedItem());
-
         itemController.reset();
         actionController.reset();
         comboBox.removeItemAt(0);
@@ -446,7 +418,6 @@
         assertEquals(1, comboBox.getModel().getSize());
         assertEquals(2, itemController.getEvents().size());
         assertNotNull(actionController.getEvent());
-
         itemController.reset();
         actionController.reset();
         comboBox.removeItemAt(0);
@@ -454,8 +425,8 @@
         assertNull(comboBox.getSelectedItem());
         assertEquals(1, itemController.getEvents().size());
         assertNotNull(actionController.getEvent());
-
         testExceptionalCase(new ExceptionalCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 comboBox.removeItemAt(0);
             }
@@ -475,7 +446,6 @@
     public void testGetItemAt() throws Exception {
         assertNull(comboBox.getItemAt(0));
         assertNull(comboBox.getItemAt(-1));
-
         comboBox.addItem("a");
         comboBox.addItem("b");
         assertEquals("a", comboBox.getItemAt(0));
@@ -486,17 +456,15 @@
     public void testAddRemoveGetFireItemListener() throws Exception {
         comboBox.getUI().uninstallUI(comboBox);
         assertEquals(0, comboBox.getItemListeners().length);
-
         ItemController l = new ItemController();
         comboBox.addItemListener(l);
         assertEquals(1, comboBox.getItemListeners().length);
         comboBox.addItemListener(new ItemController());
         assertEquals(2, comboBox.getItemListeners().length);
-
-        comboBox.fireItemStateChanged(new ItemEvent(comboBox, ItemEvent.ITEM_STATE_CHANGED, "a", ItemEvent.SELECTED));
+        comboBox.fireItemStateChanged(new ItemEvent(comboBox, ItemEvent.ITEM_STATE_CHANGED,
+                "a", ItemEvent.SELECTED));
         assertEquals(1, l.getEvents().size());
-        assertEquals(comboBox, ((ItemEvent)l.getEvents().get(0)).getSource());
-
+        assertEquals(comboBox, l.getEvents().get(0).getSource());
         comboBox.removeItemListener(l);
         assertEquals(1, comboBox.getItemListeners().length);
     }
@@ -504,17 +472,14 @@
     public void testAddRemoveGetFireActionListener() throws Exception {
         comboBox.getUI().uninstallUI(comboBox);
         assertEquals(0, comboBox.getItemListeners().length);
-
         ActionController l = new ActionController();
         comboBox.addActionListener(l);
         assertEquals(1, comboBox.getActionListeners().length);
         comboBox.addActionListener(new ActionController());
         assertEquals(2, comboBox.getActionListeners().length);
-
         comboBox.fireActionEvent();
         assertNotNull(l.getEvent());
         assertEquals(comboBox, l.getEvent().getSource());
-
         comboBox.removeActionListener(l);
         assertEquals(1, comboBox.getActionListeners().length);
     }
@@ -522,40 +487,32 @@
     public void testAddRemoveGetFirePopupListener() throws Exception {
         comboBox.getUI().uninstallUI(comboBox);
         assertEquals(0, comboBox.getItemListeners().length);
-
         PopupMenuController l = new PopupMenuController();
         comboBox.addPopupMenuListener(l);
         assertEquals(1, comboBox.getPopupMenuListeners().length);
         comboBox.addPopupMenuListener(new PopupMenuController());
         assertEquals(2, comboBox.getPopupMenuListeners().length);
-
         comboBox.firePopupMenuCanceled();
         assertNotNull(l.getEvent());
         assertEquals(PopupMenuController.CANCELLED, l.getEventType());
-
         l.reset();
         comboBox.firePopupMenuWillBecomeVisible();
         assertNotNull(l.getEvent());
         assertEquals(PopupMenuController.VISIBLE, l.getEventType());
         assertEquals(comboBox, l.getEvent().getSource());
-
         l.reset();
         comboBox.firePopupMenuWillBecomeInvisible();
         assertNotNull(l.getEvent());
         assertEquals(PopupMenuController.INVISIBLE, l.getEventType());
-
-
         comboBox.removePopupMenuListener(l);
         assertEquals(1, comboBox.getPopupMenuListeners().length);
     }
 
     public void testGetSetActionCommand() throws Exception {
         assertEquals("comboBoxChanged", comboBox.getActionCommand());
-
         comboBox.setActionCommand("anotherCommand");
         assertEquals("anotherCommand", comboBox.getActionCommand());
         assertFalse(propertyChangeController.isChanged());
-
         ActionController actionController = new ActionController();
         comboBox.addActionListener(actionController);
         comboBox.addItem("any");
@@ -565,7 +522,6 @@
     public void testGetSelectedObjects() throws Exception {
         assertNull(comboBox.getSelectedItem());
         assertEquals(0, comboBox.getSelectedObjects().length);
-
         comboBox.setEditable(true);
         comboBox.setSelectedItem("a");
         assertEquals("a", comboBox.getSelectedObjects()[0]);
@@ -573,7 +529,6 @@
 
     public void testSetEnabled() throws Exception {
         assertTrue(comboBox.isEnabled());
-
         comboBox.setEnabled(false);
         assertFalse(comboBox.isEnabled());
         assertTrue(propertyChangeController.isChanged("enabled"));
@@ -587,29 +542,24 @@
         assertTrue(propertyChangeController.isChanged("action"));
         assertEquals(action, comboBox.getAction());
         assertEquals(1, comboBox.getActionListeners().length);
-
         propertyChangeController.reset();
         comboBox.setAction(action);
         assertFalse(propertyChangeController.isChanged());
         assertEquals(1, comboBox.getActionListeners().length);
-
         action.reset();
         comboBox.fireActionEvent();
         assertEquals(1, action.getEvents().size());
-
         action.reset();
         comboBox.addActionListener(action);
         comboBox.fireActionEvent();
         assertEquals(2, action.getEvents().size());
         assertEquals(2, comboBox.getActionListeners().length);
-
         action.reset();
         comboBox.setAction(null);
         assertNull(comboBox.getAction());
         comboBox.fireActionEvent();
         assertEquals(1, action.getEvents().size());
         assertEquals(1, comboBox.getActionListeners().length);
-
         action.reset();
         comboBox.setAction(action);
         comboBox.fireActionEvent();
@@ -619,18 +569,15 @@
 
     public void testIsSetPopupVisible() throws Exception {
         createVisibleComboBox();
-
         assertFalse(comboBox.isPopupVisible());
         assertFalse(comboBox.getUI().isPopupVisible(comboBox));
         PopupMenuController pmc = new PopupMenuController();
         comboBox.addPopupMenuListener(pmc);
-
         comboBox.setPopupVisible(true);
         assertTrue(comboBox.isPopupVisible());
         assertTrue(comboBox.getUI().isPopupVisible(comboBox));
         assertNotNull(pmc.getEvent());
         assertEquals(PopupMenuController.VISIBLE, pmc.getEventType());
-
         pmc.reset();
         comboBox.getUI().setPopupVisible(comboBox, false);
         assertFalse(comboBox.isPopupVisible());
@@ -640,12 +587,9 @@
 
     public void testShowHidePopup() throws Exception {
         createVisibleComboBox();
-
         assertFalse(comboBox.isPopupVisible());
-
         comboBox.showPopup();
         assertTrue(comboBox.isPopupVisible());
-
         comboBox.hidePopup();
         assertFalse(comboBox.isPopupVisible());
     }
@@ -653,7 +597,6 @@
     public void testCreateDefaultKeySelectionManager() throws Exception {
         JComboBox.KeySelectionManager ksm = comboBox.createDefaultKeySelectionManager();
         assertNotNull(ksm);
-
         comboBox.setKeySelectionManager(null);
         comboBox.selectWithKeyChar('a');
         assertNotNull(comboBox.getKeySelectionManager());
@@ -662,83 +605,79 @@
     public void testDefaultKeySelectionManager() throws Exception {
         JComboBox.KeySelectionManager ksm = comboBox.createDefaultKeySelectionManager();
         DefaultComboBoxModel model = new DefaultComboBoxModel();
-
         assertEquals(-1, ksm.selectionForKey('a', model));
-
         model.addElement("a 0");
         model.addElement("b 0");
         model.addElement(" b 0");
-
         assertEquals(0, ksm.selectionForKey('a', model));
         assertEquals(1, ksm.selectionForKey('b', model));
         assertEquals(2, ksm.selectionForKey(' ', model));
     }
 
+    @SuppressWarnings("deprecation")
     public void testProcessKeyEvent() throws Exception {
         comboBox.setKeySelectionManager(null);
         createVisibleComboBox();
-
         PopupMenuController pmc = new PopupMenuController();
         comboBox.addPopupMenuListener(pmc);
-
-        KeyEvent event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue.getMostRecentEventTime(), 0, KeyEvent.VK_A);
+        KeyEvent event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
+                .getMostRecentEventTime(), 0, KeyEvent.VK_A);
         comboBox.processKeyEvent(event);
         assertNull(pmc.getEvent());
-
-        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue.getMostRecentEventTime(), 0, KeyEvent.VK_TAB);
+        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
+                .getMostRecentEventTime(), 0, KeyEvent.VK_TAB);
         comboBox.processKeyEvent(event);
         assertNull(pmc.getEvent());
-
         comboBox.setPopupVisible(true);
         assertNotNull(pmc.getEvent());
         assertEquals(PopupMenuController.VISIBLE, pmc.getEventType());
-
         pmc.reset();
         comboBox.addItem("a");
         comboBox.addItem("b");
-        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue.getMostRecentEventTime(), 0, KeyEvent.VK_A);
+        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
+                .getMostRecentEventTime(), 0, KeyEvent.VK_A);
         comboBox.processKeyEvent(event);
         assertNull(pmc.getEvent());
         assertEquals("a", comboBox.getSelectedItem());
-
         pmc.reset();
-        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue.getMostRecentEventTime(), 0, KeyEvent.VK_B);
+        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
+                .getMostRecentEventTime(), 0, KeyEvent.VK_B);
         comboBox.processKeyEvent(event);
         assertNull(pmc.getEvent());
         assertEquals("b", comboBox.getSelectedItem());
-
         pmc.reset();
-        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue.getMostRecentEventTime(), 0, KeyEvent.VK_A);
+        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
+                .getMostRecentEventTime(), 0, KeyEvent.VK_A);
         comboBox.processKeyEvent(event);
         assertNull(pmc.getEvent());
         assertEquals("a", comboBox.getSelectedItem());
-
         pmc.reset();
-        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue.getMostRecentEventTime(), 0, KeyEvent.VK_TAB);
+        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
+                .getMostRecentEventTime(), 0, KeyEvent.VK_TAB);
         comboBox.processKeyEvent(event);
         assertNotNull(pmc.getEvent());
         assertEquals(PopupMenuController.INVISIBLE, pmc.getEventType());
         assertEquals("a", comboBox.getSelectedItem());
-
         comboBox.setKeySelectionManager(new JComboBox.KeySelectionManager() {
             public int selectionForKey(final char key, final ComboBoxModel model) {
                 return -1;
             }
         });
         pmc.reset();
-        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue.getMostRecentEventTime(), 0, KeyEvent.VK_TAB);
+        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
+                .getMostRecentEventTime(), 0, KeyEvent.VK_TAB);
         comboBox.processKeyEvent(event);
         assertNull(pmc.getEvent());
         assertEquals("a", comboBox.getSelectedItem());
-
         pmc.reset();
-        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue.getMostRecentEventTime(), 0, KeyEvent.VK_A);
+        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
+                .getMostRecentEventTime(), 0, KeyEvent.VK_A);
         comboBox.processKeyEvent(event);
         assertNull(pmc.getEvent());
         assertEquals("a", comboBox.getSelectedItem());
-
         pmc.reset();
-        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue.getMostRecentEventTime(), 0, KeyEvent.VK_B);
+        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
+                .getMostRecentEventTime(), 0, KeyEvent.VK_B);
         comboBox.processKeyEvent(event);
         assertNull(pmc.getEvent());
         assertEquals("a", comboBox.getSelectedItem());
@@ -746,58 +685,45 @@
 
     public void testSelectWithKeyChar() throws Exception {
         comboBox.setKeySelectionManager(null);
-
         PopupMenuController pmc = new PopupMenuController();
         comboBox.addPopupMenuListener(pmc);
-
         assertFalse(comboBox.selectWithKeyChar('a'));
         assertNull(pmc.getEvent());
-
         comboBox.addItem("a1");
         comboBox.addItem("a2");
         comboBox.addItem("a3");
         comboBox.addItem("b1");
-
         assertEquals("a1", comboBox.getSelectedItem());
         assertFalse(comboBox.selectWithKeyChar('c'));
-
         assertTrue(comboBox.selectWithKeyChar('A'));
         assertEquals("a2", comboBox.getSelectedItem());
         assertNull(pmc.getEvent());
-
         assertTrue(comboBox.selectWithKeyChar('a'));
         assertEquals("a3", comboBox.getSelectedItem());
         assertNull(pmc.getEvent());
-
         assertTrue(comboBox.selectWithKeyChar('A'));
         assertEquals("a1", comboBox.getSelectedItem());
         assertNull(pmc.getEvent());
-
         assertTrue(comboBox.selectWithKeyChar('b'));
         assertEquals("b1", comboBox.getSelectedItem());
         assertNull(pmc.getEvent());
-
         assertTrue(comboBox.selectWithKeyChar('b'));
         assertEquals("b1", comboBox.getSelectedItem());
         assertNull(pmc.getEvent());
-
         comboBox.setKeySelectionManager(new JComboBox.KeySelectionManager() {
             public int selectionForKey(final char key, final ComboBoxModel model) {
                 return -1;
             }
         });
-
         assertFalse(comboBox.selectWithKeyChar('a'));
         assertEquals("b1", comboBox.getSelectedItem());
         assertFalse(comboBox.selectWithKeyChar('b'));
         assertEquals("b1", comboBox.getSelectedItem());
-
         comboBox.setKeySelectionManager(new JComboBox.KeySelectionManager() {
             public int selectionForKey(final char key, final ComboBoxModel model) {
                 return 1;
             }
         });
-
         assertTrue(comboBox.selectWithKeyChar('a'));
         assertEquals("a2", comboBox.getSelectedItem());
         assertTrue(comboBox.selectWithKeyChar('b'));
@@ -814,7 +740,6 @@
             }
         };
         comboBox.setKeySelectionManager(manager);
-
         assertEquals(manager, comboBox.getKeySelectionManager());
         assertFalse(propertyChangeController.isChanged());
     }
@@ -824,35 +749,25 @@
             public void actionPerformed(final ActionEvent e) {
             }
         };
-
         comboBox.setAction(action1);
         assertTrue(comboBox.isEnabled());
-
         action1.setEnabled(false);
         assertFalse(comboBox.isEnabled());
-
         action1.setEnabled(true);
         assertTrue(comboBox.isEnabled());
-
         Action action2 = new AbstractAction() {
             public void actionPerformed(final ActionEvent e) {
             }
         };
-
         comboBox.setAction(action2);
-
         action1.setEnabled(false);
         assertTrue(comboBox.isEnabled());
-
         action2.setEnabled(false);
         assertFalse(comboBox.isEnabled());
-
         action2.setEnabled(true);
         assertTrue(comboBox.isEnabled());
-
         comboBox.setAction(null);
         assertTrue(comboBox.isEnabled());
-
         action2.setEnabled(false);
         assertTrue(comboBox.isEnabled());
     }
@@ -862,18 +777,14 @@
         comboBox.setEnabled(false);
         assertEquals("combo tooltip", comboBox.getToolTipText());
         assertFalse(comboBox.isEnabled());
-
         Action action = new AbstractAction() {
             public void actionPerformed(final ActionEvent e) {
             }
         };
         action.putValue(Action.SHORT_DESCRIPTION, "action tooltip");
-
-
         comboBox.setAction(action);
         assertEquals("action tooltip", comboBox.getToolTipText());
         assertTrue(comboBox.isEnabled());
-
         comboBox.setAction(null);
         assertNull(comboBox.getToolTipText());
         assertTrue(comboBox.isEnabled());
@@ -883,7 +794,6 @@
         assertEquals(1, comboBox.getAncestorListeners().length);
     }
 
-
     private class ActionController implements ActionListener {
         private ActionEvent event;
 
@@ -901,7 +811,7 @@
     }
 
     private class TestAction extends AbstractAction {
-        private List events = new ArrayList();
+        private List<ActionEvent> events = new ArrayList<ActionEvent>();
 
         public void actionPerformed(final ActionEvent e) {
             events.add(e);
@@ -911,13 +821,13 @@
             events.clear();
         }
 
-        public List getEvents() {
+        public List<ActionEvent> getEvents() {
             return events;
         }
     }
 
     private class ItemController implements ItemListener {
-        private List eventList = new ArrayList();
+        private List<ItemEvent> eventList = new ArrayList<ItemEvent>();
 
         public void itemStateChanged(final ItemEvent e) {
             eventList.add(e);
@@ -927,20 +837,21 @@
             eventList.clear();
         }
 
-        public List getEvents() {
+        public List<ItemEvent> getEvents() {
             return eventList;
         }
     }
 
     private static class PopupMenuController implements PopupMenuListener {
         public static final int CANCELLED = 0;
+
         public static final int VISIBLE = 1;
-        public static final int INVISIBLE = 2;
 
+        public static final int INVISIBLE = 2;
 
         private PopupMenuEvent event;
-        private int eventType = -1;
 
+        private int eventType = -1;
 
         public void reset() {
             event = null;
@@ -971,10 +882,10 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     private void createVisibleComboBox() {
         frame = new JFrame();
         frame.getContentPane().add(comboBox);
         frame.show();
     }
-
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComponentRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComponentRTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComponentRTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComponentRTest.java Sat Nov 25 16:04:10 2006
@@ -20,27 +20,24 @@
  */
 package javax.swing;
 
-import java.awt.event.ActionListener;
-
 public class JComponentRTest extends SwingTestCase {
-    public void testComponentInstantiation() throws Exception {
-        Object result = (ActionListener)new JComboBox();
-        result = JPanel.class;
-    }
-
     public void testPaintDoubleBufferedForInvisibleComponent() throws Exception {
         JButton b = new JButton();
         b.paintDoubleBuffered(createTestGraphics());
     }
 
     public void testResetKeyboardActions() throws Exception {
-        JComponent c = new JComponent() {};
+        JComponent c = new JComponent() {
+            private static final long serialVersionUID = 1L;
+        };
         c.resetKeyboardActions();
     }
 
     public void testSetBounds() throws Throwable {
         final Marker marker = new Marker();
         final JComponent button = new JButton("JButton") {
+            private static final long serialVersionUID = 1L;
+
             @Override
             public void revalidate() {
                 marker.setOccurred();
@@ -48,7 +45,6 @@
             }
         };
         marker.reset();
-
         button.setSize(50, 500);
         assertFalse(marker.isOccurred());
     }



Mime
View raw message