harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r479240 [6/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/DefaultButtonModelTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/DefaultButtonModelTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/DefaultButtonModelTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/DefaultButtonModelTest.java Sat Nov 25 16:04:10 2006
@@ -32,27 +32,25 @@
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.util.EventListener;
-
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 
 public class DefaultButtonModelTest extends SwingTestCase {
-
     protected int find(final Object[] array, final Object value) {
         int found = 0;
         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++;
                 }
             }
         }
-
         return found;
     }
 
     class ConcreteActionListener implements ActionListener {
         public ActionEvent eventHappened = null;
+
         public void actionPerformed(final ActionEvent event) {
             eventHappened = event;
         }
@@ -60,6 +58,7 @@
 
     class ConcreteItemListener implements ItemListener {
         public ItemEvent eventHappened = null;
+
         public void itemStateChanged(final ItemEvent event) {
             eventHappened = event;
         }
@@ -67,6 +66,7 @@
 
     class ConcreteChangeListener implements ChangeListener {
         public ChangeEvent eventHappened = null;
+
         public void stateChanged(final ChangeEvent event) {
             eventHappened = event;
         }
@@ -74,17 +74,13 @@
 
     protected DefaultButtonModel buttonModel;
 
-    /*
-     * @see TestCase#setUp()
-     */
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         buttonModel = new DefaultButtonModel();
     }
 
-    /*
-     * @see TestCase#tearDown()
-     */
+    @Override
     protected void tearDown() throws Exception {
         super.tearDown();
         buttonModel = null;
@@ -93,8 +89,10 @@
     public void testDefaultButtonModel() {
         assertEquals("default mnemonic ", 0, buttonModel.getMnemonic());
         assertNull("default action command ", buttonModel.getActionCommand());
-        assertEquals("default actionListeners array ", 0, buttonModel.getActionListeners().length);
-        assertEquals("default changeListeners array ", 0, buttonModel.getChangeListeners().length);
+        assertEquals("default actionListeners array ", 0,
+                buttonModel.getActionListeners().length);
+        assertEquals("default changeListeners array ", 0,
+                buttonModel.getChangeListeners().length);
         assertEquals("default itemListeners array ", 0, buttonModel.getItemListeners().length);
         assertNull("default group ", buttonModel.getGroup());
         assertNull("default selected objects array ", buttonModel.getSelectedObjects());
@@ -115,46 +113,49 @@
         ActionListener listener7 = new ConcreteActionListener();
         ActionListener listener8 = new ConcreteActionListener();
         ActionListener listener9 = new ConcreteActionListener();
-
         EventListener[] listeners = buttonModel.getListeners(ChangeListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 0);
-
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 0);
         buttonModel.addChangeListener(listener1);
         buttonModel.addChangeListener(listener2);
         listeners = buttonModel.getListeners(ChangeListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 2);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 2);
         assertTrue("listener's added successfully ", find(listeners, listener1) == 1);
         assertTrue("listener's added successfully ", find(listeners, listener2) == 1);
-
         buttonModel.addChangeListener(listener3);
         buttonModel.addItemListener(listener5);
         buttonModel.addItemListener(listener4);
         listeners = buttonModel.getListeners(ChangeListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 3);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 3);
         assertTrue("listener's added successfully ", find(listeners, listener1) == 1);
         assertTrue("listener's added successfully ", find(listeners, listener2) == 1);
         assertTrue("listener's added successfully ", find(listeners, listener3) == 1);
         listeners = buttonModel.getListeners(ItemListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 2);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 2);
         assertTrue("listener's added successfully ", find(listeners, listener4) == 1);
         assertTrue("listener's added successfully ", find(listeners, listener5) == 1);
-
         buttonModel.addItemListener(listener6);
         buttonModel.addActionListener(listener7);
         buttonModel.addActionListener(listener8);
         buttonModel.addActionListener(listener9);
         listeners = buttonModel.getListeners(ChangeListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 3);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 3);
         assertTrue("listener's added successfully ", find(listeners, listener1) == 1);
         assertTrue("listener's added successfully ", find(listeners, listener2) == 1);
         assertTrue("listener's added successfully ", find(listeners, listener3) == 1);
         listeners = buttonModel.getListeners(ItemListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 3);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 3);
         assertTrue("listener's added successfully ", find(listeners, listener4) == 1);
         assertTrue("listener's added successfully ", find(listeners, listener5) == 1);
         assertTrue("listener's added successfully ", find(listeners, listener6) == 1);
         listeners = buttonModel.getListeners(ActionListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 3);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 3);
         assertTrue("listener's added successfully ", find(listeners, listener7) == 1);
         assertTrue("listener's added successfully ", find(listeners, listener8) == 1);
         assertTrue("listener's added successfully ", find(listeners, listener9) == 1);
@@ -164,63 +165,62 @@
         ChangeListener listener1 = new ConcreteChangeListener();
         ChangeListener listener2 = new ConcreteChangeListener();
         ChangeListener listener3 = new ConcreteChangeListener();
-
         buttonModel.addChangeListener(listener1);
         buttonModel.addChangeListener(listener2);
         buttonModel.addChangeListener(listener2);
         buttonModel.addChangeListener(listener3);
-
         EventListener[] listeners = buttonModel.getListeners(ChangeListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 4);
-
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 4);
         buttonModel.removeChangeListener(listener1);
         listeners = buttonModel.getListeners(ChangeListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 3);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 3);
         assertTrue("listener's removed successfully ", find(listeners, listener3) == 1);
         assertTrue("listener's removed successfully ", find(listeners, listener2) == 2);
-
         buttonModel.removeChangeListener(listener2);
         listeners = buttonModel.getListeners(ChangeListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 2);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 2);
         assertTrue("listener's removed successfully ", find(listeners, listener3) == 1);
         assertTrue("listener's removed successfully ", find(listeners, listener2) == 1);
-
         buttonModel.removeChangeListener(listener2);
         listeners = buttonModel.getListeners(ChangeListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 1);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 1);
         assertTrue("listener's removed successfully ", find(listeners, listener3) == 1);
         assertTrue("listener's removed successfully ", find(listeners, listener2) == 0);
-
         buttonModel.removeChangeListener(listener2);
         listeners = buttonModel.getListeners(ChangeListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 1);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 1);
         assertTrue("listener's removed successfully ", find(listeners, listener3) == 1);
         assertTrue("listener's removed successfully ", find(listeners, listener2) == 0);
-
         buttonModel.removeChangeListener(listener3);
         listeners = buttonModel.getListeners(ChangeListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 0);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 0);
         assertTrue("listener's removed successfully ", find(listeners, listener3) == 0);
     }
 
     public void testAddChangeListener() {
         ChangeListener listener1 = new ConcreteChangeListener();
         ChangeListener listener2 = new ConcreteChangeListener();
-
         buttonModel.addChangeListener(listener1);
         EventListener[] listeners = buttonModel.getListeners(ChangeListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 1);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 1);
         assertEquals("listener's added successfully ", listeners[0], listener1);
-
         buttonModel.addChangeListener(listener2);
         listeners = buttonModel.getListeners(ChangeListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 2);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 2);
         assertTrue("listener's added successfully ", find(listeners, listener1) == 1);
         assertTrue("listener's added successfully ", find(listeners, listener2) == 1);
-
         buttonModel.addChangeListener(listener2);
         listeners = buttonModel.getListeners(ChangeListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 3);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 3);
         assertTrue("listener's added successfully ", find(listeners, listener1) == 1);
         assertTrue("listener's added successfully ", find(listeners, listener2) == 2);
     }
@@ -231,7 +231,8 @@
      */
     public void testGetChangeListeners() {
         EventListener[] listeners = buttonModel.getListeners(ChangeListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 0);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 0);
     }
 
     public void testSetGroup() {
@@ -239,13 +240,10 @@
         ButtonGroup group2 = new ButtonGroup();
         ButtonGroup group3 = new ButtonGroup();
         assertNull("default group ", buttonModel.getGroup());
-
         buttonModel.setGroup(group1);
         assertEquals("group ", group1, buttonModel.getGroup());
-
         buttonModel.setGroup(group2);
         assertEquals("group ", group2, buttonModel.getGroup());
-
         buttonModel.setGroup(group3);
         assertEquals("group ", group3, buttonModel.getGroup());
     }
@@ -258,15 +256,11 @@
         String command1 = "command1";
         String command2 = "command2";
         String command3 = "command3";
-
         assertNull("default action command ", buttonModel.getActionCommand());
-
         buttonModel.setActionCommand(command1);
         assertEquals("action command ", command1, buttonModel.getActionCommand());
-
         buttonModel.setActionCommand(command2);
         assertEquals("action command ", command2, buttonModel.getActionCommand());
-
         buttonModel.setActionCommand(command3);
         assertEquals("action command ", command3, buttonModel.getActionCommand());
     }
@@ -283,63 +277,62 @@
         ItemListener listener1 = new ConcreteItemListener();
         ItemListener listener2 = new ConcreteItemListener();
         ItemListener listener3 = new ConcreteItemListener();
-
         buttonModel.addItemListener(listener1);
         buttonModel.addItemListener(listener2);
         buttonModel.addItemListener(listener2);
         buttonModel.addItemListener(listener3);
-
         EventListener[] listeners = buttonModel.getListeners(ItemListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 4);
-
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 4);
         buttonModel.removeItemListener(listener1);
         listeners = buttonModel.getListeners(ItemListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 3);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 3);
         assertTrue("listener's removed successfully ", find(listeners, listener3) == 1);
         assertTrue("listener's removed successfully ", find(listeners, listener2) == 2);
-
         buttonModel.removeItemListener(listener2);
         listeners = buttonModel.getListeners(ItemListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 2);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 2);
         assertTrue("listener's removed successfully ", find(listeners, listener3) == 1);
         assertTrue("listener's removed successfully ", find(listeners, listener2) == 1);
-
         buttonModel.removeItemListener(listener2);
         listeners = buttonModel.getListeners(ItemListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 1);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 1);
         assertTrue("listener's removed successfully ", find(listeners, listener3) == 1);
         assertTrue("listener's removed successfully ", find(listeners, listener2) == 0);
-
         buttonModel.removeItemListener(listener2);
         listeners = buttonModel.getListeners(ItemListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 1);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 1);
         assertTrue("listener's removed successfully ", find(listeners, listener3) == 1);
         assertTrue("listener's removed successfully ", find(listeners, listener2) == 0);
-
         buttonModel.removeItemListener(listener3);
         listeners = buttonModel.getListeners(ItemListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 0);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 0);
         assertTrue("listener's removed successfully ", find(listeners, listener3) == 0);
     }
 
     public void testAddItemListener() {
         ItemListener listener1 = new ConcreteItemListener();
         ItemListener listener2 = new ConcreteItemListener();
-
         buttonModel.addItemListener(listener1);
         EventListener[] listeners = buttonModel.getListeners(ItemListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 1);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 1);
         assertEquals("listener's added successfully ", listeners[0], listener1);
-
         buttonModel.addItemListener(listener2);
         listeners = buttonModel.getListeners(ItemListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 2);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 2);
         assertTrue("listener's added successfully ", find(listeners, listener1) == 1);
         assertTrue("listener's added successfully ", find(listeners, listener2) == 1);
-
         buttonModel.addItemListener(listener2);
         listeners = buttonModel.getListeners(ItemListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 3);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 3);
         assertTrue("listener's added successfully ", find(listeners, listener1) == 1);
         assertTrue("listener's added successfully ", find(listeners, listener2) == 2);
     }
@@ -350,7 +343,8 @@
      */
     public void testGetItemListeners() {
         EventListener[] listeners = buttonModel.getListeners(ItemListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 0);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 0);
     }
 
     public void testFireItemStateChanged() {
@@ -360,17 +354,14 @@
         ItemEvent event2 = new ItemEvent(buttonModel, 111, item2, 1);
         ConcreteItemListener listener1 = new ConcreteItemListener();
         ConcreteItemListener listener2 = new ConcreteItemListener();
-
         buttonModel.addItemListener(listener1);
         buttonModel.addItemListener(listener2);
         buttonModel.fireItemStateChanged(event1);
         assertEquals("event fired ", event1, listener1.eventHappened);
         assertEquals("event fired ", event1, listener2.eventHappened);
-
         buttonModel.fireItemStateChanged(event2);
         assertEquals("event fired ", event2, listener1.eventHappened);
         assertEquals("event fired ", event2, listener2.eventHappened);
-
         buttonModel.fireItemStateChanged(null);
         assertNull("event fired ", listener1.eventHappened);
         assertNull("event fired ", listener2.eventHappened);
@@ -383,17 +374,14 @@
         ActionEvent event2 = new ActionEvent(buttonModel, 111, command2, 1);
         ConcreteActionListener listener1 = new ConcreteActionListener();
         ConcreteActionListener listener2 = new ConcreteActionListener();
-
         buttonModel.addActionListener(listener1);
         buttonModel.addActionListener(listener2);
         buttonModel.fireActionPerformed(event1);
         assertEquals("event fired ", event1, listener1.eventHappened);
         assertEquals("event fired ", event1, listener2.eventHappened);
-
         buttonModel.fireActionPerformed(event2);
         assertEquals("event fired ", event2, listener1.eventHappened);
         assertEquals("event fired ", event2, listener2.eventHappened);
-
         buttonModel.fireActionPerformed(null);
         assertNull("event fired ", listener1.eventHappened);
         assertNull("event fired ", listener2.eventHappened);
@@ -402,7 +390,6 @@
     public void testFireActionPerformed2() {
         ConcreteActionListener listener1 = new ConcreteActionListener();
         ConcreteActionListener listener2 = new ConcreteActionListener();
-
         buttonModel.addActionListener(listener1);
         buttonModel.addActionListener(listener2);
         buttonModel.setPressed(true);
@@ -419,7 +406,6 @@
         ChangeEvent event2 = null;
         ConcreteChangeListener listener1 = new ConcreteChangeListener();
         ConcreteChangeListener listener2 = new ConcreteChangeListener();
-
         buttonModel.addChangeListener(listener1);
         buttonModel.addChangeListener(listener2);
         buttonModel.fireStateChanged();
@@ -427,21 +413,23 @@
         assertTrue("event fired ", listener1.eventHappened != null);
         assertTrue("event fired ", listener2.eventHappened != null);
         assertTrue("one event fired ", listener1.eventHappened == listener2.eventHappened);
-        assertEquals("event fired properly ", ChangeEvent.class, listener1.eventHappened.getClass());
-        assertEquals("event fired properly ", ChangeEvent.class, listener2.eventHappened.getClass());
+        assertEquals("event fired properly ", ChangeEvent.class, listener1.eventHappened
+                .getClass());
+        assertEquals("event fired properly ", ChangeEvent.class, listener2.eventHappened
+                .getClass());
         assertEquals("event fired properly ", buttonModel, listener1.eventHappened.getSource());
         assertEquals("event fired properly ", buttonModel, listener2.eventHappened.getSource());
-
         buttonModel.fireStateChanged();
         event2 = listener1.eventHappened;
         assertTrue("event fired ", listener1.eventHappened != null);
         assertTrue("event fired ", listener2.eventHappened != null);
         assertTrue("one event fired ", listener1.eventHappened == listener2.eventHappened);
-        assertEquals("event fired properly ", ChangeEvent.class, listener1.eventHappened.getClass());
-        assertEquals("event fired properly ", ChangeEvent.class, listener2.eventHappened.getClass());
+        assertEquals("event fired properly ", ChangeEvent.class, listener1.eventHappened
+                .getClass());
+        assertEquals("event fired properly ", ChangeEvent.class, listener2.eventHappened
+                .getClass());
         assertEquals("event fired properly ", buttonModel, listener1.eventHappened.getSource());
         assertEquals("event fired properly ", buttonModel, listener2.eventHappened.getSource());
-
         assertTrue("the same event is fired always ", event1 == event2);
     }
 
@@ -449,63 +437,62 @@
         ActionListener listener1 = new ConcreteActionListener();
         ActionListener listener2 = new ConcreteActionListener();
         ActionListener listener3 = new ConcreteActionListener();
-
         buttonModel.addActionListener(listener1);
         buttonModel.addActionListener(listener2);
         buttonModel.addActionListener(listener2);
         buttonModel.addActionListener(listener3);
-
         EventListener[] listeners = buttonModel.getListeners(ActionListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 4);
-
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 4);
         buttonModel.removeActionListener(listener1);
         listeners = buttonModel.getListeners(ActionListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 3);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 3);
         assertTrue("listener's removed successfully ", find(listeners, listener3) == 1);
         assertTrue("listener's removed successfully ", find(listeners, listener2) == 2);
-
         buttonModel.removeActionListener(listener2);
         listeners = buttonModel.getListeners(ActionListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 2);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 2);
         assertTrue("listener's removed successfully ", find(listeners, listener3) == 1);
         assertTrue("listener's removed successfully ", find(listeners, listener2) == 1);
-
         buttonModel.removeActionListener(listener2);
         listeners = buttonModel.getListeners(ActionListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 1);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 1);
         assertTrue("listener's removed successfully ", find(listeners, listener3) == 1);
         assertTrue("listener's removed successfully ", find(listeners, listener2) == 0);
-
         buttonModel.removeActionListener(listener2);
         listeners = buttonModel.getListeners(ActionListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 1);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 1);
         assertTrue("listener's removed successfully ", find(listeners, listener3) == 1);
         assertTrue("listener's removed successfully ", find(listeners, listener2) == 0);
-
         buttonModel.removeActionListener(listener3);
         listeners = buttonModel.getListeners(ActionListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 0);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 0);
         assertTrue("listener's removed successfully ", find(listeners, listener3) == 0);
     }
 
     public void testAddActionListener() {
         ActionListener listener1 = new ConcreteActionListener();
         ActionListener listener2 = new ConcreteActionListener();
-
         buttonModel.addActionListener(listener1);
         EventListener[] listeners = buttonModel.getListeners(ActionListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 1);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 1);
         assertEquals("listener's added successfully ", listeners[0], listener1);
-
         buttonModel.addActionListener(listener2);
         listeners = buttonModel.getListeners(ActionListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 2);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 2);
         assertTrue("listener's added successfully ", find(listeners, listener1) == 1);
         assertTrue("listener's added successfully ", find(listeners, listener2) == 1);
-
         buttonModel.addActionListener(listener2);
         listeners = buttonModel.getListeners(ActionListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 3);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 3);
         assertTrue("listener's added successfully ", find(listeners, listener1) == 1);
         assertTrue("listener's added successfully ", find(listeners, listener2) == 2);
     }
@@ -516,7 +503,8 @@
      */
     public void testGetActionListeners() {
         EventListener[] listeners = buttonModel.getListeners(ActionListener.class);
-        assertTrue("listener's array has the proper size ", listeners != null && listeners.length == 0);
+        assertTrue("listener's array has the proper size ", listeners != null
+                && listeners.length == 0);
     }
 
     public void testSetSelected() {
@@ -530,51 +518,54 @@
         buttonModel.addChangeListener(listener2);
         buttonModel.addItemListener(listener3);
         buttonModel.addItemListener(listener4);
-
         buttonModel.setSelected(value1);
         assertEquals("Selected ", value1, buttonModel.isSelected());
         assertEquals("event fired source ", buttonModel, listener1.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened.getClass());
+        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened
+                .getClass());
         assertEquals("event fired source ", buttonModel, listener2.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened.getClass());
+        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened
+                .getClass());
         assertEquals("event fired source ", buttonModel, listener3.eventHappened.getItem());
         assertEquals("event fired value ", 1, listener3.eventHappened.getStateChange());
         assertEquals("event fired source ", buttonModel, listener4.eventHappened.getItem());
         assertEquals("event fired value ", 1, listener4.eventHappened.getStateChange());
-
         buttonModel.setSelected(value2);
         assertEquals("Selected ", value2, buttonModel.isSelected());
         assertEquals("event fired source ", buttonModel, listener1.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened.getClass());
+        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened
+                .getClass());
         assertEquals("event fired source ", buttonModel, listener2.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened.getClass());
+        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened
+                .getClass());
         assertEquals("event fired source ", buttonModel, listener3.eventHappened.getItem());
         assertEquals("event fired value ", 2, listener3.eventHappened.getStateChange());
         assertEquals("event fired source ", buttonModel, listener4.eventHappened.getItem());
         assertEquals("event fired value ", 2, listener4.eventHappened.getStateChange());
-
         buttonModel.setSelected(value1);
         assertEquals("Selected ", value1, buttonModel.isSelected());
         assertEquals("event fired source ", buttonModel, listener1.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened.getClass());
+        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened
+                .getClass());
         assertEquals("event fired source ", buttonModel, listener2.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened.getClass());
+        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened
+                .getClass());
         assertEquals("event fired source ", buttonModel, listener3.eventHappened.getItem());
         assertEquals("event fired value ", 1, listener3.eventHappened.getStateChange());
         assertEquals("event fired source ", buttonModel, listener4.eventHappened.getItem());
         assertEquals("event fired value ", 1, listener4.eventHappened.getStateChange());
-
         buttonModel.setSelected(value2);
         assertEquals("Selected ", value2, buttonModel.isSelected());
         assertEquals("event fired source ", buttonModel, listener1.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened.getClass());
+        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened
+                .getClass());
         assertEquals("event fired source ", buttonModel, listener2.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened.getClass());
+        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened
+                .getClass());
         assertEquals("event fired source ", buttonModel, listener3.eventHappened.getItem());
         assertEquals("event fired value ", 2, listener3.eventHappened.getStateChange());
         assertEquals("event fired source ", buttonModel, listener4.eventHappened.getItem());
         assertEquals("event fired value ", 2, listener4.eventHappened.getStateChange());
-
         listener1.eventHappened = null;
         listener2.eventHappened = null;
         listener3.eventHappened = null;
@@ -585,7 +576,6 @@
         assertNull("event wasn't fired ", listener2.eventHappened);
         assertNull("event wasn't fired ", listener3.eventHappened);
         assertNull("event wasn't fired ", listener4.eventHappened);
-
         buttonModel.setEnabled(true);
         buttonModel.setSelected(false);
         buttonModel.setEnabled(false);
@@ -601,27 +591,27 @@
         buttonModel.addChangeListener(listener1);
         buttonModel.addChangeListener(listener2);
         buttonModel.setRollover(value1);
-
         assertEquals("Rollover ", value1, buttonModel.isRollover());
         assertEquals("event fired source ", buttonModel, listener1.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened.getClass());
+        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened
+                .getClass());
         assertEquals("event fired source ", buttonModel, listener2.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened.getClass());
-
+        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened
+                .getClass());
         buttonModel.setRollover(value2);
         assertEquals("Rollover ", value2, buttonModel.isRollover());
         assertEquals("event fired source ", buttonModel, listener1.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened.getClass());
+        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened
+                .getClass());
         assertEquals("event fired source ", buttonModel, listener2.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened.getClass());
-
+        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened
+                .getClass());
         listener1.eventHappened = null;
         listener2.eventHappened = null;
         buttonModel.setRollover(value2);
         assertEquals("Rollover ", value2, buttonModel.isRollover());
         assertNull("event wasn't fired ", listener1.eventHappened);
         assertNull("event wasn't fired ", listener2.eventHappened);
-
         buttonModel.setEnabled(true);
         buttonModel.setRollover(false);
         buttonModel.setEnabled(false);
@@ -639,20 +629,21 @@
         buttonModel.addChangeListener(listener2);
         buttonModel.addActionListener(listener3);
         buttonModel.setPressed(value1);
-
         assertEquals("Pressed ", value1, buttonModel.isPressed());
         assertEquals("event fired source ", buttonModel, listener1.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened.getClass());
+        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened
+                .getClass());
         assertEquals("event fired source ", buttonModel, listener2.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened.getClass());
-
+        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened
+                .getClass());
         buttonModel.setPressed(value2);
         assertEquals("Pressed ", value2, buttonModel.isPressed());
         assertEquals("event fired source ", buttonModel, listener1.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened.getClass());
+        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened
+                .getClass());
         assertEquals("event fired source ", buttonModel, listener2.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened.getClass());
-
+        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened
+                .getClass());
         listener1.eventHappened = null;
         listener2.eventHappened = null;
         buttonModel.setPressed(value2);
@@ -664,7 +655,6 @@
         listener3.eventHappened = null;
         buttonModel.setPressed(false);
         assertNotNull(listener3.eventHappened);
-
         buttonModel.setEnabled(true);
         buttonModel.setPressed(false);
         buttonModel.setEnabled(false);
@@ -680,28 +670,27 @@
         buttonModel.addChangeListener(listener1);
         buttonModel.addChangeListener(listener2);
         buttonModel.setEnabled(value1);
-
         assertEquals("Enabled ", value1, buttonModel.isEnabled());
         assertEquals("event fired source ", buttonModel, listener1.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened.getClass());
+        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened
+                .getClass());
         assertEquals("event fired source ", buttonModel, listener2.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened.getClass());
-
+        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened
+                .getClass());
         buttonModel.setEnabled(value2);
         assertEquals("Enabled ", value2, buttonModel.isEnabled());
         assertEquals("event fired source ", buttonModel, listener1.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened.getClass());
+        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened
+                .getClass());
         assertEquals("event fired source ", buttonModel, listener2.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened.getClass());
-
+        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened
+                .getClass());
         listener1.eventHappened = null;
         listener2.eventHappened = null;
         buttonModel.setEnabled(value2);
         assertEquals("Enabled ", value2, buttonModel.isEnabled());
         assertNull("event wasn't fired ", listener1.eventHappened);
         assertNull("event wasn't fired ", listener2.eventHappened);
-
-
         buttonModel.setEnabled(true);
     }
 
@@ -711,7 +700,6 @@
         buttonModel.setRollover(true);
         buttonModel.setSelected(true);
         buttonModel.setArmed(true);
-
         buttonModel.setEnabled(false);
         assertFalse(buttonModel.isArmed());
         assertFalse(buttonModel.isPressed());
@@ -731,27 +719,27 @@
         buttonModel.addChangeListener(listener1);
         buttonModel.addChangeListener(listener2);
         buttonModel.setArmed(value1);
-
         assertEquals("Armed ", value1, buttonModel.isArmed());
         assertEquals("event fired source ", buttonModel, listener1.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened.getClass());
+        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened
+                .getClass());
         assertEquals("event fired source ", buttonModel, listener2.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened.getClass());
-
+        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened
+                .getClass());
         buttonModel.setArmed(value2);
         assertEquals("Armed ", value2, buttonModel.isArmed());
         assertEquals("event fired source ", buttonModel, listener1.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened.getClass());
+        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened
+                .getClass());
         assertEquals("event fired source ", buttonModel, listener2.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened.getClass());
-
+        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened
+                .getClass());
         listener1.eventHappened = null;
         listener2.eventHappened = null;
         buttonModel.setArmed(value2);
         assertEquals("Armed ", value2, buttonModel.isArmed());
         assertNull("event wasn't fired ", listener1.eventHappened);
         assertNull("event wasn't fired ", listener2.eventHappened);
-
         buttonModel.setEnabled(true);
         buttonModel.setArmed(false);
         buttonModel.setEnabled(false);
@@ -767,29 +755,34 @@
         buttonModel.addChangeListener(listener1);
         buttonModel.addChangeListener(listener2);
         buttonModel.setMnemonic(value1);
-
         assertEquals("mnemonic ", value1, buttonModel.getMnemonic());
         assertEquals("event fired source ", buttonModel, listener1.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened.getClass());
+        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened
+                .getClass());
         assertEquals("event fired source ", buttonModel, listener2.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened.getClass());
-
+        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened
+                .getClass());
         buttonModel.setMnemonic(value2);
         assertEquals("mnemonic ", value2, buttonModel.getMnemonic());
         assertEquals("event fired source ", buttonModel, listener1.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened.getClass());
+        assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened
+                .getClass());
         assertEquals("event fired source ", buttonModel, listener2.eventHappened.getSource());
-        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened.getClass());
-
+        assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened
+                .getClass());
         listener1.eventHappened = null;
         listener2.eventHappened = null;
         buttonModel.setMnemonic(value2);
         assertEquals("mnemonic ", value2, buttonModel.getMnemonic());
         if (!isHarmony()) {
-            assertEquals("event fired source ", buttonModel, listener1.eventHappened.getSource());
-            assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened.getClass());
-            assertEquals("event fired source ", buttonModel, listener2.eventHappened.getSource());
-            assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened.getClass());
+            assertEquals("event fired source ", buttonModel, listener1.eventHappened
+                    .getSource());
+            assertEquals("event fired class ", ChangeEvent.class, listener1.eventHappened
+                    .getClass());
+            assertEquals("event fired source ", buttonModel, listener2.eventHappened
+                    .getSource());
+            assertEquals("event fired class ", ChangeEvent.class, listener2.eventHappened
+                    .getClass());
         } else {
             assertNull("event hasn't fired", listener1.eventHappened);
             assertNull("event hasn't fired", listener2.eventHappened);
@@ -834,6 +827,7 @@
         so.flush();
         InputStream fi = new ByteArrayInputStream(fo.toByteArray());
         ObjectInputStream si = new ObjectInputStream(fi);
-        DefaultButtonModel ressurectedButtonModel = (DefaultButtonModel)si.readObject();
+        DefaultButtonModel ressurectedButtonModel = (DefaultButtonModel) si.readObject();
+        assertNotNull(ressurectedButtonModel);
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/DefaultCellEditorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/DefaultCellEditorTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/DefaultCellEditorTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/DefaultCellEditorTest.java Sat Nov 25 16:04:10 2006
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 /**
  * @author Anton Avtamonov
  * @version $Revision$
@@ -22,15 +21,10 @@
 package javax.swing;
 
 import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
 import java.awt.event.ItemEvent;
 import java.awt.event.KeyEvent;
 import java.awt.event.MouseEvent;
 import java.util.Arrays;
-import java.util.EventObject;
-
-import javax.swing.JComboBox;
-import javax.swing.JTextField;
 import javax.swing.event.CellEditorListener;
 import javax.swing.event.ChangeEvent;
 import javax.swing.table.BasicSwingTableTestCase;
@@ -42,9 +36,7 @@
         super(name);
     }
 
-    protected void setUp() throws Exception {
-    }
-
+    @Override
     protected void tearDown() throws Exception {
         editor = null;
     }
@@ -52,66 +44,56 @@
     public void testDefaultCellEditor() throws Exception {
         JTextField field = new JTextField();
         editor = new DefaultCellEditor(field);
-
         assertEquals(field, editor.editorComponent);
         assertNotNull(editor.delegate);
         assertEquals(2, editor.clickCountToStart);
         assertEquals("", editor.delegate.getCellEditorValue());
     }
 
+    @SuppressWarnings("deprecation")
     public void testEditorDelegate_TextField() throws Exception {
         JTextField field = new JTextField();
         editor = new DefaultCellEditor(field);
         assertTrue(Arrays.asList(field.getActionListeners()).contains(editor.delegate));
         assertEquals(2, editor.getClickCountToStart());
-
         assertEquals(field.getText(), editor.delegate.getCellEditorValue());
         assertEquals(field.getText(), editor.getCellEditorValue());
-
         field.setText("text1");
         assertEquals("text1", editor.delegate.getCellEditorValue());
         assertEquals("text1", editor.getCellEditorValue());
-
         editor.delegate.setValue("text2");
         assertEquals("text2", editor.delegate.getCellEditorValue());
         assertEquals("text2", editor.getCellEditorValue());
         assertEquals(field.getText(), editor.getCellEditorValue());
-
         editor.delegate.setValue(new Integer(4));
         assertEquals("4", editor.delegate.getCellEditorValue());
         assertEquals("4", editor.getCellEditorValue());
         assertEquals(field.getText(), editor.getCellEditorValue());
-
         assertTrue(editor.delegate.isCellEditable(null));
         assertTrue(editor.isCellEditable(null));
-
-        assertTrue(editor.delegate.isCellEditable(new MouseEvent(field, MouseEvent.BUTTON2, 0, 0, 0, 0, 2, true)));
-        assertFalse(editor.delegate.isCellEditable(new MouseEvent(field, MouseEvent.BUTTON2, 0, 0, 0, 0, 1, true)));
-
+        assertTrue(editor.delegate.isCellEditable(new MouseEvent(field, MouseEvent.BUTTON2, 0,
+                0, 0, 0, 2, true)));
+        assertFalse(editor.delegate.isCellEditable(new MouseEvent(field, MouseEvent.BUTTON2, 0,
+                0, 0, 0, 1, true)));
         assertTrue(editor.isCellEditable(null));
-        assertTrue(editor.delegate.isCellEditable(new KeyEvent(field, KeyEvent.KEY_RELEASED, 0, 0, 0)));
+        assertTrue(editor.delegate.isCellEditable(new KeyEvent(field, KeyEvent.KEY_RELEASED, 0,
+                0, 0)));
         assertTrue(editor.isCellEditable(new KeyEvent(field, KeyEvent.KEY_TYPED, 0, 0, 0)));
-
         assertTrue(editor.delegate.shouldSelectCell(null));
         assertTrue(editor.shouldSelectCell(null));
-
         TestCellEditorListener listener = new TestCellEditorListener();
         editor.addCellEditorListener(listener);
         assertTrue(editor.delegate.startCellEditing(null));
         assertFalse(listener.isOccured());
-
         editor.delegate.setValue("any");
         assertTrue(editor.delegate.stopCellEditing());
         assertTrue(listener.isOccured(TestCellEditorListener.STOPPPED));
         assertEquals("any", editor.getCellEditorValue());
-
         listener.reset();
         editor.delegate.setValue("another");
         editor.delegate.cancelCellEditing();
         assertTrue(listener.isOccured(TestCellEditorListener.CANCELED));
         assertEquals("another", editor.getCellEditorValue());
-
-
         listener.reset();
         field.fireActionPerformed();
         assertTrue(listener.isOccured(TestCellEditorListener.STOPPPED));
@@ -122,48 +104,38 @@
         editor = new DefaultCellEditor(check);
         assertTrue(Arrays.asList(check.getActionListeners()).contains(editor.delegate));
         assertEquals(1, editor.getClickCountToStart());
-
         assertEquals(Boolean.FALSE, editor.delegate.getCellEditorValue());
         assertEquals(Boolean.FALSE, editor.getCellEditorValue());
-
         check.setSelected(true);
         assertEquals(Boolean.TRUE, editor.delegate.getCellEditorValue());
         assertEquals(Boolean.TRUE, editor.getCellEditorValue());
-
         editor.delegate.setValue("text2");
         assertEquals(Boolean.FALSE, editor.delegate.getCellEditorValue());
-
         editor.delegate.setValue(Boolean.TRUE);
         assertEquals(Boolean.TRUE, editor.delegate.getCellEditorValue());
         assertEquals(Boolean.TRUE, editor.getCellEditorValue());
         assertTrue(check.isSelected());
-
         assertTrue(editor.delegate.isCellEditable(null));
         assertTrue(editor.isCellEditable(null));
-
-        assertTrue(editor.delegate.isCellEditable(new MouseEvent(check, MouseEvent.BUTTON2, 0, 0, 0, 0, 1, true)));
-        assertFalse(editor.delegate.isCellEditable(new MouseEvent(check, MouseEvent.BUTTON2, 0, 0, 0, 0, 0, true)));
-
+        assertTrue(editor.delegate.isCellEditable(new MouseEvent(check, MouseEvent.BUTTON2, 0,
+                0, 0, 0, 1, true)));
+        assertFalse(editor.delegate.isCellEditable(new MouseEvent(check, MouseEvent.BUTTON2, 0,
+                0, 0, 0, 0, true)));
         assertTrue(editor.delegate.shouldSelectCell(null));
         assertTrue(editor.shouldSelectCell(null));
-
         TestCellEditorListener listener = new TestCellEditorListener();
         editor.addCellEditorListener(listener);
         assertTrue(editor.delegate.startCellEditing(null));
         assertFalse(listener.isOccured());
-
         editor.delegate.setValue(Boolean.TRUE);
         assertTrue(editor.delegate.stopCellEditing());
         assertTrue(listener.isOccured(TestCellEditorListener.STOPPPED));
         assertEquals(Boolean.TRUE, editor.getCellEditorValue());
-
         listener.reset();
         editor.delegate.setValue("any");
         editor.delegate.cancelCellEditing();
         assertTrue(listener.isOccured(TestCellEditorListener.CANCELED));
         assertEquals(Boolean.FALSE, editor.getCellEditorValue());
-
-
         listener.reset();
         check.fireActionPerformed(new ActionEvent(this, 0, "cmd"));
         assertTrue(listener.isOccured(TestCellEditorListener.STOPPPED));
@@ -175,65 +147,50 @@
         assertTrue(Arrays.asList(cb.getActionListeners()).contains(editor.delegate));
         assertFalse(Arrays.asList(cb.getItemListeners()).contains(editor.delegate));
         assertEquals(1, editor.getClickCountToStart());
-
-
         assertNull(editor.delegate.getCellEditorValue());
         assertTrue(editor.delegate.isCellEditable(null));
         assertTrue(editor.delegate.shouldSelectCell(null));
-
         cb.getModel().setSelectedItem("selected");
         assertEquals("selected", cb.getSelectedItem());
         assertEquals("selected", editor.delegate.getCellEditorValue());
         assertEquals("selected", editor.getCellEditorValue());
-
         editor.delegate.setValue("any");
         assertEquals("selected", editor.delegate.getCellEditorValue());
-
-
-        ((DefaultComboBoxModel)cb.getModel()).addElement("elem1");
-        ((DefaultComboBoxModel)cb.getModel()).addElement("elem2");
+        ((DefaultComboBoxModel) cb.getModel()).addElement("elem1");
+        ((DefaultComboBoxModel) cb.getModel()).addElement("elem2");
         assertEquals("selected", editor.delegate.getCellEditorValue());
-
         editor.delegate.setValue("elem1");
         assertEquals("elem1", editor.delegate.getCellEditorValue());
         assertEquals("elem1", editor.getCellEditorValue());
-
         assertTrue(editor.delegate.isCellEditable(null));
         assertTrue(editor.isCellEditable(null));
-
-        assertTrue(editor.delegate.isCellEditable(new MouseEvent(cb, MouseEvent.BUTTON2, 0, 0, 0, 0, 1, true)));
-        assertFalse(editor.delegate.isCellEditable(new MouseEvent(cb, MouseEvent.BUTTON2, 0, 0, 0, 0, 0, true)));
-
+        assertTrue(editor.delegate.isCellEditable(new MouseEvent(cb, MouseEvent.BUTTON2, 0, 0,
+                0, 0, 1, true)));
+        assertFalse(editor.delegate.isCellEditable(new MouseEvent(cb, MouseEvent.BUTTON2, 0, 0,
+                0, 0, 0, true)));
         assertTrue(editor.delegate.shouldSelectCell(null));
         assertTrue(editor.shouldSelectCell(null));
-
         TestCellEditorListener listener = new TestCellEditorListener();
         editor.addCellEditorListener(listener);
         assertTrue(editor.delegate.startCellEditing(null));
         assertFalse(listener.isOccured());
-
         editor.delegate.setValue("elem2");
         assertTrue(editor.delegate.stopCellEditing());
         assertTrue(listener.isOccured(TestCellEditorListener.STOPPPED));
         assertEquals("elem2", editor.getCellEditorValue());
-
         listener.reset();
         editor.delegate.setValue("elem1");
         editor.delegate.cancelCellEditing();
         assertTrue(listener.isOccured(TestCellEditorListener.CANCELED));
         assertEquals("elem1", editor.getCellEditorValue());
-
-
         listener.reset();
         cb.fireActionEvent();
         assertTrue(listener.isOccured(TestCellEditorListener.STOPPPED));
-
         listener.reset();
         cb.fireItemStateChanged(new ItemEvent(cb, 0, "elem2", 0));
         assertFalse(listener.isOccured());
     }
 
-
     public void testGetComponent() throws Exception {
         JComboBox cb = new JComboBox();
         editor = new DefaultCellEditor(cb);
@@ -243,40 +200,37 @@
     public void testGetSetClickCountToStart() throws Exception {
         editor = new DefaultCellEditor(new JTextField());
         assertEquals(2, editor.getClickCountToStart());
-
         editor = new DefaultCellEditor(new JCheckBox());
         assertEquals(1, editor.getClickCountToStart());
-
         editor = new DefaultCellEditor(new JComboBox());
         assertEquals(1, editor.getClickCountToStart());
-
         editor.setClickCountToStart(-5);
         assertEquals(-5, editor.getClickCountToStart());
-
         editor.setClickCountToStart(10);
         assertEquals(10, editor.getClickCountToStart());
     }
 
-
-
     public void testGetTreeCellEditorComponent() throws Exception {
         editor = new DefaultCellEditor(new JTextField());
-        assertEquals(editor.getComponent(), editor.getTreeCellEditorComponent(new JTree(), "any", false, false, false, 0));
+        assertEquals(editor.getComponent(), editor.getTreeCellEditorComponent(new JTree(),
+                "any", false, false, false, 0));
         assertEquals("any", editor.getCellEditorValue());
     }
 
     public void testGetTableCellEditorComponent() throws Exception {
         editor = new DefaultCellEditor(new JTextField());
-        assertEquals(editor.getComponent(), editor.getTableCellEditorComponent(new JTable(), "any", false, 0, 0));
+        assertEquals(editor.getComponent(), editor.getTableCellEditorComponent(new JTable(),
+                "any", false, 0, 0));
         assertEquals("any", editor.getCellEditorValue());
     }
 
-
     private class TestCellEditorListener implements CellEditorListener {
         public static final int CANCELED = 1;
+
         public static final int STOPPPED = 2;
 
         private ChangeEvent event;
+
         private int eventType = -1;
 
         public void editingCanceled(final ChangeEvent e) {

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/DefaultComboBoxModelTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/DefaultComboBoxModelTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/DefaultComboBoxModelTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/DefaultComboBoxModelTest.java Sat Nov 25 16:04:10 2006
@@ -23,24 +23,26 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Vector;
-
 import javax.swing.event.ListDataEvent;
 import javax.swing.event.ListDataListener;
 
 public class DefaultComboBoxModelTest extends SwingTestCase {
     private DefaultComboBoxModel model;
+
     private TestListener listener;
 
     public DefaultComboBoxModelTest(final String name) {
         super(name);
     }
 
+    @Override
     protected void setUp() throws Exception {
         model = new DefaultComboBoxModel();
         listener = new TestListener();
         model.addListDataListener(listener);
     }
 
+    @Override
     protected void tearDown() throws Exception {
         model = null;
         listener = null;
@@ -50,16 +52,14 @@
         assertEquals(0, model.getSize());
         assertNull(model.getSelectedItem());
         assertEquals(0, listener.getEvents().size());
-
-        Object[] arrayData = new Object[] {"1", "2", "3"};
+        Object[] arrayData = new Object[] { "1", "2", "3" };
         model = new DefaultComboBoxModel(arrayData);
         assertEquals("1", model.getSelectedItem());
         assertEquals(arrayData.length, model.getSize());
         assertEquals("2", model.getElementAt(1));
         arrayData[1] = "21";
         assertEquals("2", model.getElementAt(1));
-
-        Vector vectorData = new Vector();
+        Vector<String> vectorData = new Vector<String>();
         vectorData.add("a");
         vectorData.add("b");
         model = new DefaultComboBoxModel(vectorData);
@@ -78,19 +78,16 @@
         checkListDataEvent(0, ListDataEvent.INTERVAL_ADDED, 0, 0);
         checkListDataEvent(1, ListDataEvent.CONTENTS_CHANGED, -1, -1);
         assertEquals("1", model.getSelectedItem());
-
         listener.reset();
         model.addElement("2");
         assertEquals(2, model.getSize());
         checkListDataEvent(0, ListDataEvent.INTERVAL_ADDED, 1, 1);
-
         assertEquals("1", model.getElementAt(0));
         assertEquals("2", model.getElementAt(1));
     }
 
     public void testGetElementAt() throws Exception {
         assertNull(model.getElementAt(0));
-
         model.addElement("a");
         model.addElement("b");
         assertEquals("a", model.getElementAt(0));
@@ -100,7 +97,6 @@
 
     public void testGetIndexOf() throws Exception {
         assertEquals(-1, model.getIndexOf("a"));
-
         model.addElement("a");
         model.addElement("b");
         model.addElement("a");
@@ -119,16 +115,15 @@
 
     public void testInsertElementAt() throws Exception {
         testExceptionalCase(new ExceptionalCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 model.insertElementAt("a", 1);
             }
         });
-
         model.insertElementAt("a", 0);
         checkListDataEvent(0, ListDataEvent.INTERVAL_ADDED, 0, 0);
         model.addElement("b");
         model.addElement("c");
-
         listener.reset();
         model.insertElementAt("after_a", 1);
         assertEquals("after_a", model.getElementAt(1));
@@ -139,7 +134,6 @@
         model.addElement("a");
         model.addElement("b");
         model.addElement("c");
-
         listener.reset();
         model.removeAllElements();
         assertEquals(0, model.getSize());
@@ -151,11 +145,9 @@
         model.removeElement("a");
         assertEquals(0, model.getSize());
         assertEquals(0, listener.getEvents().size());
-
         model.addElement("a");
         model.addElement("b");
         model.addElement("c");
-
         listener.reset();
         model.removeElement("b");
         assertEquals(2, model.getSize());
@@ -165,29 +157,26 @@
 
     public void testRemoveElementAt() throws Exception {
         testExceptionalCase(new ExceptionalCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 model.removeElementAt(0);
             }
         });
-
         model.addElement("a");
         model.addElement("b");
         model.addElement("c");
-
         testExceptionalCase(new ExceptionalCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 model.removeElementAt(3);
             }
         });
-
         model.removeElementAt(0);
         assertEquals(2, model.getSize());
         assertEquals("b", model.getElementAt(0));
-
         model.removeElementAt(1);
         assertEquals(1, model.getSize());
         assertEquals("b", model.getElementAt(0));
-
         model.removeElementAt(0);
         assertEquals(0, model.getSize());
     }
@@ -197,27 +186,21 @@
         model.setSelectedItem("3");
         assertEquals("3", model.getSelectedItem());
         checkListDataEvent(0, ListDataEvent.CONTENTS_CHANGED, -1, -1);
-
         listener.reset();
         model.setSelectedItem(null);
         checkListDataEvent(0, ListDataEvent.CONTENTS_CHANGED, -1, -1);
-
         listener.reset();
         model.setSelectedItem(null);
         assertEquals(0, listener.getEvents().size());
-
         model.setSelectedItem("3");
         model.addElement("0");
         model.addElement("1");
         model.addElement("2");
         assertEquals("3", model.getSelectedItem());
-
         model.removeElement("0");
         assertEquals("3", model.getSelectedItem());
-
         model.addElement("3");
         assertEquals("3", model.getSelectedItem());
-
         model.addElement("4");
         listener.reset();
         model.removeElement("3");
@@ -225,16 +208,13 @@
         checkListDataEvent(0, ListDataEvent.CONTENTS_CHANGED, -1, -1);
         checkListDataEvent(1, ListDataEvent.INTERVAL_REMOVED, 2, 2);
         assertEquals(2, listener.getEvents().size());
-
         model.removeElementAt(1);
         assertEquals("1", model.getSelectedItem());
-
         model.addElement("5");
         model.addElement("6");
         assertEquals("1", model.getSelectedItem());
         model.removeElementAt(1);
         assertEquals("1", model.getSelectedItem());
-
         model.addElement("7");
         model.addElement("1");
         listener.reset();
@@ -242,22 +222,18 @@
         assertEquals("5", model.getSelectedItem());
         checkListDataEvent(0, ListDataEvent.CONTENTS_CHANGED, -1, -1);
         checkListDataEvent(1, ListDataEvent.INTERVAL_REMOVED, 0, 0);
-
         listener.reset();
         model.removeAllElements();
         assertNull(model.getSelectedItem());
         checkListDataEvent(0, ListDataEvent.INTERVAL_REMOVED, 0, 3);
         assertEquals(1, listener.getEvents().size());
-
         listener.reset();
         model.setSelectedItem("0");
         checkListDataEvent(0, ListDataEvent.CONTENTS_CHANGED, -1, -1);
-
         listener.reset();
         model.removeAllElements();
         assertNull(model.getSelectedItem());
         assertEquals(0, listener.getEvents().size());
-
         model.addElement("a");
         model.addElement("b");
         model.addElement("c");
@@ -265,21 +241,19 @@
         assertEquals("a", model.getSelectedItem());
         model.setSelectedItem("b");
         checkListDataEvent(0, ListDataEvent.CONTENTS_CHANGED, -1, -1);
-
         listener.reset();
         model.setSelectedItem("b");
         assertEquals(0, listener.getEvents().size());
-
         listener.reset();
         model.setSelectedItem("c");
         checkListDataEvent(0, ListDataEvent.CONTENTS_CHANGED, -1, -1);
         assertEquals(1, listener.getEvents().size());
     }
 
-
-    private void checkListDataEvent(final int eventIndex, final int eventType, final int index0, final int index1) {
+    private void checkListDataEvent(final int eventIndex, final int eventType,
+            final int index0, final int index1) {
         assertTrue(listener.getEvents().size() > eventIndex);
-        ListDataEvent event = (ListDataEvent)listener.getEvents().get(eventIndex);
+        ListDataEvent event = listener.getEvents().get(eventIndex);
         assertEquals(model, event.getSource());
         assertEquals(eventType, event.getType());
         assertEquals(index0, event.getIndex0());
@@ -287,7 +261,7 @@
     }
 
     private class TestListener implements ListDataListener {
-        private List events = new ArrayList();
+        private List<ListDataEvent> events = new ArrayList<ListDataEvent>();
 
         public void contentsChanged(final ListDataEvent e) {
             events.add(e);
@@ -301,7 +275,7 @@
             events.add(e);
         }
 
-        public List getEvents() {
+        public List<ListDataEvent> getEvents() {
             return events;
         }
 

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/DefaultDesktopManagerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/DefaultDesktopManagerTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/DefaultDesktopManagerTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/DefaultDesktopManagerTest.java Sat Nov 25 16:04:10 2006
@@ -18,7 +18,6 @@
  * @author Vadim L. Bogdanov
  * @version $Revision$
  */
-
 package javax.swing;
 
 import java.awt.Point;
@@ -30,11 +29,13 @@
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 
-
 public class DefaultDesktopManagerTest extends SwingTestCase {
     private DefaultDesktopManager manager;
+
     private JDesktopPane desktop;
+
     private JInternalFrame frame;
+
     private JFrame rootFrame;
 
     public DefaultDesktopManagerTest(final String name) {
@@ -49,9 +50,7 @@
         frame.setSize(70, 100);
         rootFrame = new JFrame();
         rootFrame.setContentPane(desktop);
-
         //rootFrame.getContentPane().add(frame);
-
         rootFrame.setSize(100, 200);
         frame.setVisible(true);
         rootFrame.setVisible(true);
@@ -60,6 +59,7 @@
     /*
      * @see TestCase#setUp()
      */
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         desktop = new JDesktopPane();
@@ -72,9 +72,9 @@
     /*
      * @see TestCase#tearDown()
      */
+    @Override
     protected void tearDown() throws Exception {
         super.tearDown();
-
         if (rootFrame != null) {
             rootFrame.dispose();
             rootFrame = null;
@@ -95,13 +95,10 @@
      */
     public void testSetWasIcon() {
         desktop.setDesktopManager(manager);
-
         assertFalse("wasIcon is false by default", manager.wasIcon(frame));
-
         // test set to true
         manager.setWasIcon(frame, Boolean.TRUE);
         assertTrue("wasIcon is set to true", manager.wasIcon(frame));
-
         // test set to false
         manager.setWasIcon(frame, Boolean.FALSE);
         assertFalse("wasIcon is set to false", manager.wasIcon(frame));
@@ -115,11 +112,9 @@
     public void testSetGetPreviousBounds() {
         Rectangle bounds = new Rectangle(1, 1, 12, 13);
         desktop.setDesktopManager(manager);
-
         manager.setPreviousBounds(frame, bounds);
         assertTrue("bounds are set", manager.getPreviousBounds(frame) == bounds);
-        assertTrue("bounds are set as normal bounds",
-                   frame.getNormalBounds() == bounds);
+        assertTrue("bounds are set as normal bounds", frame.getNormalBounds() == bounds);
     }
 
     /*
@@ -128,7 +123,6 @@
     public void testGetBoundsForIconOf() {
         final int totalWidth = 330;
         final int totalHeight = 65;
-
         desktop.setDesktopManager(manager);
         desktop.setSize(totalWidth, totalHeight);
         JInternalFrame frame2 = new JInternalFrame("frame 2");
@@ -136,7 +130,6 @@
         JInternalFrame frame3 = new JInternalFrame("frame 3");
         desktop.add(frame3);
         desktop.add(new JPanel());
-
         int width = frame.getDesktopIcon().getWidth();
         int height = frame.getDesktopIcon().getHeight();
         Rectangle bounds = manager.getBoundsForIconOf(frame);
@@ -144,7 +137,6 @@
         assertEquals("y", bounds.y, totalHeight - height);
         assertEquals("width", bounds.width, width);
         assertEquals("height", bounds.height, height);
-
         width = frame2.getDesktopIcon().getWidth();
         height = frame2.getDesktopIcon().getHeight();
         manager.iconifyFrame(frame);
@@ -154,7 +146,6 @@
         assertEquals("y", bounds.y, totalHeight - height);
         assertEquals("width", bounds.width, width);
         assertEquals("height", bounds.height, height);
-
         width = frame3.getDesktopIcon().getWidth();
         height = frame3.getDesktopIcon().getHeight();
         manager.iconifyFrame(frame2);
@@ -163,7 +154,6 @@
         assertEquals("y", bounds.y, totalHeight - 2 * height);
         assertEquals("width", bounds.width, width);
         assertEquals("height", bounds.height, height);
-
         JInternalFrame frame4 = new JInternalFrame();
         width = frame4.getDesktopIcon().getWidth();
         height = frame4.getDesktopIcon().getHeight();
@@ -179,15 +169,12 @@
      */
     public void testRemoveIconFor() {
         desktop.setDesktopManager(manager);
-
         // test when f is not iconified
         manager.removeIconFor(frame);
-
         // test when f is iconified
         manager.iconifyFrame(frame);
         manager.removeIconFor(frame);
         assertFalse("icon is removed", desktop.isAncestorOf(frame));
-
         // test when the internal frame is not inside any desktop pane
         manager.removeIconFor(new JInternalFrame());
     }
@@ -197,17 +184,13 @@
      */
     public void testOpenFrame() {
         JInternalFrame frame2 = new JInternalFrame();
-
         // test openFrame for the internal frame outside the container
         manager.openFrame(frame2);
-
         // test ordinary openFrame
         desktop.add(frame2.getDesktopIcon());
         manager.openFrame(frame2);
-        assertFalse("desktopIcon is removed",
-                    desktop.isAncestorOf(frame2.getDesktopIcon()));
+        assertFalse("desktopIcon is removed", desktop.isAncestorOf(frame2.getDesktopIcon()));
         assertTrue("frame is added", desktop.isAncestorOf(frame2));
-
         // test openFrame for the frame that is already opened
         manager.openFrame(frame2);
     }
@@ -220,16 +203,13 @@
         Rectangle bounds = new Rectangle(1, 1, 50, 60);
         frame.setBounds(bounds);
         manager.maximizeFrame(frame);
-
         // test ordinary minimize
         manager.minimizeFrame(frame);
         assertTrue("the bounds are restored", frame.getBounds().equals(bounds));
         assertFalse("the copy of bounds is used", frame.getBounds() == bounds);
-
         // test minimize the second time
         manager.minimizeFrame(frame);
         assertTrue("the bounds are restored", frame.getBounds().equals(bounds));
-
         // test minimize some separate frame
         manager.minimizeFrame(new JInternalFrame());
     }
@@ -241,7 +221,6 @@
         desktop.setSize(100, 200);
         Rectangle bounds = new Rectangle(1, 1, 50, 60);
         frame.setBounds(bounds);
-
         // test simple maximize
         manager.maximizeFrame(frame);
         assertTrue("x ok", frame.getX() == 0);
@@ -250,7 +229,6 @@
         assertTrue("height ok", frame.getHeight() == desktop.getHeight());
         assertTrue("normal bounds are saved", frame.getNormalBounds().equals(bounds));
         assertFalse("bounds are save in a copy", frame.getNormalBounds() == bounds);
-
         // test maximize for the internal frame that is not inside of any
         // desktop pane - NullPointernException
         //manager.maximizeFrame(new JInternalFrame());
@@ -265,13 +243,12 @@
         desktop.setDesktopManager(manager);
         frame.setLayer(1);
         createAndShowRootFrame();
-
         // test correct iconify
         //try {
         //    SwingUtilities.invokeAndWait(new Runnable() {
         //        public void run() {
-                    manager.activateFrame(frame);
-                    manager.iconifyFrame(frame);
+        manager.activateFrame(frame);
+        manager.iconifyFrame(frame);
         //        }
         //    });
         //} catch (Exception e) {
@@ -281,20 +258,17 @@
         assertFalse("frame is removed", desktop.isAncestorOf(frame));
         assertTrue("icon is added", desktop.isAncestorOf(frame.getDesktopIcon()));
         assertTrue("wasIcon is true", manager.wasIcon(frame));
-        assertTrue("layer is set", JDesktopPane.getLayer(frame.getDesktopIcon()) ==
-                   frame.getLayer());
+        assertTrue("layer is set", JLayeredPane.getLayer(frame.getDesktopIcon()) == frame
+                .getLayer());
         //assertTrue("isIcon is true", frame.isIcon());
-
         // test iconify for the frame that is already iconified
         manager.iconifyFrame(frame);
-
         // call with null argument causes to NullPointerException
-
         // test correct deiconify
         //try {
         //    SwingUtilities.invokeAndWait(new Runnable() {
         //        public void run() {
-                    manager.deiconifyFrame(frame);
+        manager.deiconifyFrame(frame);
         //        }
         //    });
         //} catch (Exception e) {
@@ -303,10 +277,8 @@
         assertTrue("frame is added", desktop.isAncestorOf(frame));
         assertFalse("icon is removed", desktop.isAncestorOf(frame.getDesktopIcon()));
         assertTrue("wasIcon is true", manager.wasIcon(frame));
-
         // test deiconify for the deiconified frame
         manager.deiconifyFrame(frame);
-
         // test iconify for the internal frame without desktop pane
         manager.iconifyFrame(new JInternalFrame());
     }
@@ -317,11 +289,9 @@
     public void testDeactivateFrame() {
         manager.activateFrame(frame);
         assertTrue("activated", desktop.getSelectedFrame() == frame);
-
         // test ordinary deactivate
         manager.deactivateFrame(frame);
         assertNull("deactivated", desktop.getSelectedFrame());
-
         // test deactivate of the internal frame without desktop pane
         manager.deactivateFrame(new JInternalFrame());
     }
@@ -333,17 +303,13 @@
         // test ordinary close
         manager.closeFrame(frame);
         assertFalse("frame is removed", desktop.isAncestorOf(frame));
-        assertFalse("desktopIcon is removed",
-                desktop.isAncestorOf(frame.getDesktopIcon()));
-
+        assertFalse("desktopIcon is removed", desktop.isAncestorOf(frame.getDesktopIcon()));
         // test close of the iconified internal frame
         desktop.add(frame);
         manager.iconifyFrame(frame);
         manager.closeFrame(frame);
         assertFalse("frame is removed", desktop.isAncestorOf(frame));
-        assertFalse("desktopIcon is removed",
-                desktop.isAncestorOf(frame.getDesktopIcon()));
-
+        assertFalse("desktopIcon is removed", desktop.isAncestorOf(frame.getDesktopIcon()));
         // test close of the closed internal frame
         manager.closeFrame(frame);
     }
@@ -366,16 +332,13 @@
             assertFalse("exception", true);
         }
         assertTrue("frame3 is selected", frame3.isSelected());
-
         // test activate
         manager.activateFrame(frame);
         assertTrue("moved to the front", desktop.getIndexOf(frame) == 1);
         assertFalse("frame3 is not selected", frame3.isSelected());
         assertTrue("", desktop.getSelectedFrame() == frame);
-
         // test activate of already activated frame
         manager.activateFrame(frame);
-
         // test activate some separate internal frame
         manager.activateFrame(new JInternalFrame());
     }
@@ -386,20 +349,16 @@
      */
     public void testSetBoundsForFrame() {
         Rectangle bounds = new Rectangle(1, 2, 50, 60);
-
         // test ordinary setBoundsForFrame
-        manager.setBoundsForFrame(frame, bounds.x, bounds.y,
-                bounds.width, bounds.height);
+        manager.setBoundsForFrame(frame, bounds.x, bounds.y, bounds.width, bounds.height);
         assertTrue("the bounds are set", frame.getBounds().equals(bounds));
-
         // test setBoundsForFrame for a separate frame
-        manager.setBoundsForFrame(new JInternalFrame(), bounds.x, bounds.y,
-                bounds.width, bounds.height);
-
+        manager.setBoundsForFrame(new JInternalFrame(), bounds.x, bounds.y, bounds.width,
+                bounds.height);
         // test setBoundsForFrame for some component
-        manager.setBoundsForFrame(new JPanel(), bounds.x, bounds.y,
-                bounds.width, bounds.height);
-
+        manager
+                .setBoundsForFrame(new JPanel(), bounds.x, bounds.y, bounds.width,
+                        bounds.height);
         // Note: could test that repaint was called
     }
 
@@ -409,13 +368,11 @@
     public void testResizeFrame() {
         Rectangle bounds = new Rectangle(1, 2, 50, 60);
         createAndShowRootFrame();
-
         // OUTLINE_DRAG_MODE, the frame's bounds are not changed
         desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
         manager.beginResizingFrame(frame, 0);
         manager.resizeFrame(frame, bounds.x, bounds.y, bounds.width, bounds.height);
         assertFalse("the bounds aren't set", frame.getBounds().equals(bounds));
-
         // LIVE_DRAG_MODE, the frame bounds are changed
         desktop.setDragMode(JDesktopPane.LIVE_DRAG_MODE);
         manager.beginResizingFrame(frame, 0);
@@ -429,13 +386,11 @@
     public void testDragFrame() {
         Point p = new Point(3, 5);
         createAndShowRootFrame();
-
         // OUTLINE_DRAG_MODE, the frame's location is not changed
         desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
         manager.beginDraggingFrame(frame);
         manager.dragFrame(frame, p.x, p.y);
         assertFalse("the location isn't changed", frame.getLocation().equals(p));
-
         // LIVE_DRAG_MODE, the frame's location is changed
         desktop.setDragMode(JDesktopPane.LIVE_DRAG_MODE);
         manager.beginDraggingFrame(frame);
@@ -449,13 +404,10 @@
     public void testBeginResizingFrame() {
         // we can only test that there is no crash
         desktop.setDragMode(JDesktopPane.LIVE_DRAG_MODE);
-
         // the normal case
         manager.beginResizingFrame(frame, 0);
-
         // the frame without a parent
         manager.beginResizingFrame(new JInternalFrame(), 0);
-
         // the frame without a JDesktopPane parent
         JPanel parent = new JPanel();
         parent.add(frame);
@@ -467,13 +419,10 @@
      */
     public void testBeginDraggingFrame() {
         desktop.setDragMode(JDesktopPane.LIVE_DRAG_MODE);
-
         // the normal case
         manager.beginDraggingFrame(frame);
-
         // the frame without a parent
         //manager.beginDraggingFrame(new JInternalFrame());
-
         // the frame without a JDesktopPane parent
         JPanel parent = new JPanel();
         parent.add(frame);
@@ -490,7 +439,6 @@
         manager.beginResizingFrame(frame, 0);
         manager.resizeFrame(frame, bounds.x, bounds.y, bounds.width, bounds.height);
         assertFalse("the bounds aren't changed", frame.getBounds().equals(bounds));
-
         manager.endResizingFrame(frame);
         assertTrue("the bounds are changed", frame.getBounds().equals(bounds));
     }
@@ -505,7 +453,6 @@
         manager.beginDraggingFrame(frame);
         manager.dragFrame(frame, p.x, p.y);
         assertFalse("the location isn't changed", frame.getLocation().equals(p));
-
         manager.endDraggingFrame(frame);
         assertTrue("the location is changed", frame.getLocation().equals(p));
     }
@@ -519,12 +466,12 @@
         so.writeObject(manager);
         // so.flush();
         so.close();
-
         // reading
         DefaultDesktopManager manager2 = null;
         InputStream fi = new ByteArrayInputStream(fo.toByteArray());
         ObjectInputStream si = new ObjectInputStream(fi);
-        manager2 = (DefaultDesktopManager)si.readObject();
+        manager2 = (DefaultDesktopManager) si.readObject();
+        assertNotNull(manager2);
         si.close();
     }
 }



Mime
View raw message