harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r479240 [15/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/JMenuTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JMenuTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JMenuTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JMenuTest.java Sat Nov 25 16:04:10 2006
@@ -15,9 +15,9 @@
  *  limitations under the License.
  */
 /**
-* @author Alexander T. Simbirtsev
-* @version $Revision$
-*/
+ * @author Alexander T. Simbirtsev
+ * @version $Revision$
+ */
 package javax.swing;
 
 import java.awt.Component;
@@ -27,16 +27,17 @@
 import java.awt.event.ActionEvent;
 import java.beans.PropertyChangeListener;
 import java.util.EventListener;
-
 import javax.swing.JPopupMenuTest.MyAction;
 import javax.swing.event.MenuEvent;
 import javax.swing.event.MenuListener;
 
+@SuppressWarnings("serial")
 public class JMenuTest extends JMenuItemTest {
-
     class ConcreteMenuListener implements MenuListener {
         public Object event;
+
         public Object src;
+
         private final boolean debugOut;
 
         ConcreteMenuListener() {
@@ -73,34 +74,38 @@
     };
 
     protected JMenu menu;
+
     private int menuOffsetX;
+
     private int menuOffsetY;
+
     private int submenuOffsetX;
+
     private int submenuOffsetY;
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
-
         menu = new JMenu();
         menuItem = menu;
         button = menuItem;
-
         menuOffsetX = UIManager.getInt("Menu.menuPopupOffsetX");
         menuOffsetY = UIManager.getInt("Menu.menuPopupOffsetY");
         submenuOffsetX = UIManager.getInt("Menu.submenuPopupOffsetX");
         submenuOffsetY = UIManager.getInt("Menu.submenuPopupOffsetY");
     }
 
+    @Override
     protected void tearDown() throws Exception {
         UIManager.put("Menu.menuPopupOffsetX", new Integer(menuOffsetX));
         UIManager.put("Menu.menuPopupOffsetY", new Integer(menuOffsetY));
         UIManager.put("Menu.submenuPopupOffsetX", new Integer(submenuOffsetX));
         UIManager.put("Menu.submenuPopupOffsetY", new Integer(submenuOffsetY));
-
         menu = null;
         super.tearDown();
     }
 
+    @Override
     public void testJMenuItem() {
     }
 
@@ -122,7 +127,6 @@
         assertFalse(menu.isTopLevelMenu());
         assertFalse(menu.isSelected());
         assertEquals(200, menu.getDelay());
-
         assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
         assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
         assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
@@ -149,13 +153,11 @@
         assertFalse(menu.isSelected());
         assertTrue(menuItem.isFocusable());
         assertEquals(200, menu.getDelay());
-
         assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
         assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
         assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
         assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
-
-        button = menuItem = menu = new JMenu((String)null);
+        button = menuItem = menu = new JMenu((String) null);
         assertEquals("text ", "", button.getText());
     }
 
@@ -179,13 +181,11 @@
         assertFalse(menu.isSelected());
         assertTrue(menuItem.isFocusable());
         assertEquals(200, menu.getDelay());
-
         assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
         assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
         assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
         assertEquals(SwingConstants.CENTER, button.getVerticalTextPosition());
-
-        button = menuItem = menu = new JMenu((String)null, false);
+        button = menuItem = menu = new JMenu((String) null, false);
         assertEquals("text ", "", button.getText());
     }
 
@@ -195,22 +195,19 @@
     public void testJMenuAction() {
         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 = createNewIcon();
         String text = "texttext";
         MyAction action = new MyAction(text, icon);
         button = menuItem = menu = new JMenu(action);
-
         assertEquals("icon ", icon, menuItem.getIcon());
         assertEquals("text ", text, menuItem.getText());
         assertEquals("action", action, menuItem.getAction());
@@ -220,10 +217,8 @@
         assertNull("accelerator ", menuItem.getAccelerator());
         assertTrue(menuItem.isFocusable());
         assertEquals(200, menu.getDelay());
-
         action.setEnabled(false);
         button = menuItem = menu = new JMenu(action);
-
         assertEquals("icon ", icon, menuItem.getIcon());
         assertEquals("text ", text, menuItem.getText());
         assertEquals("action", action, menuItem.getAction());
@@ -231,16 +226,13 @@
         assertFalse("selected ", menuItem.isSelected());
         assertFalse("enabled ", menuItem.isEnabled());
         assertFalse("default FocusPainted", menuItem.isFocusPainted());
-
-        button = menuItem = menu = new JMenu((Action)null);
-
+        button = menuItem = menu = new JMenu((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());
-
         assertEquals(menu, menuItem.getComponent());
         assertEquals(0, menu.getItemCount());
         assertEquals(0, menu.getMenuComponentCount());
@@ -249,9 +241,8 @@
         assertEquals(menu.getPopupMenu(), menu.getSubElements()[0]);
         assertFalse(menu.isTopLevelMenu());
         assertFalse(menu.isSelected());
-
-        assertTrue("menuItem model is of the proper type", menuItem.getModel() instanceof DefaultButtonModel);
-
+        assertTrue("menuItem model is of the proper type",
+                menuItem.getModel() instanceof DefaultButtonModel);
         assertEquals(SwingConstants.LEADING, button.getHorizontalAlignment());
         assertEquals(SwingConstants.TRAILING, button.getHorizontalTextPosition());
         assertEquals(SwingConstants.CENTER, button.getVerticalAlignment());
@@ -261,11 +252,12 @@
     /*
      * Test method for 'javax.swing.JMenu.getAccessibleContext()'
      */
+    @Override
     public void testGetAccessibleContext() {
-        boolean assertedValue = (menuItem.getAccessibleContext() != null &&
-                menuItem.getAccessibleContext().getClass().getName().equals("javax.swing.JMenu$AccessibleJMenu"));
-
-        assertTrue("AccessibleContext created properly ",  assertedValue);
+        boolean assertedValue = (menuItem.getAccessibleContext() != null && menuItem
+                .getAccessibleContext().getClass().getName().equals(
+                        "javax.swing.JMenu$AccessibleJMenu"));
+        assertTrue("AccessibleContext created properly ", assertedValue);
     }
 
     /*
@@ -277,7 +269,6 @@
         assertTrue(menu.getPopupMenu().getComponentOrientation().isLeftToRight());
         menu.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
         assertFalse(menu.getPopupMenu().getComponentOrientation().isLeftToRight());
-
         menu.add(item);
         menu.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
         assertFalse(item.getComponentOrientation().isLeftToRight());
@@ -292,7 +283,6 @@
         assertTrue(menu.getPopupMenu().getComponentOrientation().isLeftToRight());
         menu.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
         assertFalse(menu.getPopupMenu().getComponentOrientation().isLeftToRight());
-
         menu.add(item);
         menu.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
         assertTrue(item.getComponentOrientation().isLeftToRight());
@@ -304,23 +294,21 @@
     public void testRemoveInt() {
         JMenuItem item1 = new JMenuItem();
         JMenuItem item2 = new JMenuItem();
-
         menu.add(item1);
         menu.add(item2);
         assertEquals(2, menu.getMenuComponentCount());
         assertSame(item1, menu.getMenuComponent(0));
         assertSame(item2, menu.getMenuComponent(1));
-
         try {
             menu.remove(5);
             fail("no exception has been thrown");
-        } catch (IllegalArgumentException e) {}
-
+        } catch (IllegalArgumentException e) {
+        }
         try {
             menu.remove(-5);
             fail("no exception has been thrown");
-        } catch (IllegalArgumentException e) {}
-
+        } catch (IllegalArgumentException e) {
+        }
         menu.remove(0);
         assertEquals(1, menu.getMenuComponentCount());
         assertSame(item2, menu.getMenuComponent(0));
@@ -332,17 +320,14 @@
     public void testRemoveComponent() {
         JMenuItem item1 = new JMenuItem();
         JMenuItem item2 = new JMenuItem();
-
         menu.add(item1);
         menu.add(item2);
         assertEquals(2, menu.getMenuComponentCount());
         assertSame(item1, menu.getMenuComponent(0));
         assertSame(item2, menu.getMenuComponent(1));
-
         menu.remove(new JButton());
         assertEquals(2, menu.getMenuComponentCount());
-
-        menu.remove((Component)item1);
+        menu.remove((Component) item1);
         assertEquals(1, menu.getMenuComponentCount());
         assertSame(item2, menu.getMenuComponent(0));
     }
@@ -353,17 +338,14 @@
     public void testRemoveJMenuItem() {
         JMenuItem item1 = new JMenuItem();
         JMenuItem item2 = new JMenuItem();
-
         menu.add(item1);
         menu.add(item2);
         assertEquals(2, menu.getMenuComponentCount());
         assertSame(item1, menu.getMenuComponent(0));
         assertSame(item2, menu.getMenuComponent(1));
-
         menu.remove(item1);
         assertEquals(1, menu.getMenuComponentCount());
         assertSame(item2, menu.getMenuComponent(0));
-
         menu.remove(item1);
         assertEquals(1, menu.getMenuComponentCount());
         assertSame(item2, menu.getMenuComponent(0));
@@ -375,11 +357,9 @@
     public void testRemoveAll() {
         JMenuItem item1 = new JMenuItem();
         JMenuItem item2 = new JMenuItem();
-
         assertEquals(0, menu.getMenuComponentCount());
         menu.removeAll();
         assertEquals(0, menu.getMenuComponentCount());
-
         menu.add(item1);
         menu.add(item2);
         assertEquals(2, menu.getMenuComponentCount());
@@ -390,6 +370,7 @@
     /*
      * Test method for 'javax.swing.JMenu.getUIClassID()'
      */
+    @Override
     public void testGetUIClassID() {
         assertEquals("MenuUI", menu.getUIClassID());
     }
@@ -397,6 +378,7 @@
     /*
      * Test method for 'javax.swing.JMenu.doClick(int)'
      */
+    @Override
     public void testDoClick() {
     }
 
@@ -412,13 +394,11 @@
         menuBar.add(menu2);
         menu2.add(menu1);
         menu1.add(menu);
-
         assertFalse(menu.isSelected());
         menu.doClick(0);
         assertTrue(menu.isSelected());
         assertTrue(menu1.isSelected());
         assertTrue(menu2.isSelected());
-
         frame.dispose();
     }
 
@@ -428,13 +408,11 @@
     public void testSetIsSelected() {
         ConcreteMenuListener listener = new ConcreteMenuListener();
         menu.addMenuListener(listener);
-
         menu.setSelected(true);
         assertTrue(menu.getModel().isSelected());
         assertTrue(menu.isSelected());
         assertEquals("selected", listener.event);
         listener.event = null;
-
         menu.setSelected(false);
         assertFalse(menu.getModel().isSelected());
         assertFalse(menu.isSelected());
@@ -445,16 +423,19 @@
     /*
      * Test method for 'javax.swing.JMenu.setAccelerator(KeyStroke)'
      */
+    @Override
     public void testSetAccelerator() {
         try {
             menu.setAccelerator(null);
             fail("no exception has been thrown");
-        } catch (Error e) {}
+        } catch (Error e) {
+        }
     }
 
     /*
      * Test method for 'javax.swing.JMenu.getComponent()'
      */
+    @Override
     public void testGetComponent() {
         assertSame(menu, menu.getComponent());
     }
@@ -462,36 +443,31 @@
     /*
      * Test method for 'javax.swing.JMenu.getSubElements()'
      */
+    @Override
     public void testGetSubElements() {
         JMenuItem item1 = new JMenuItem();
         JMenuItem item2 = new JMenuItem();
         JMenuItem item3 = new JMenuItem();
         JMenuItem item4 = new JMenuItem();
-
         if (!isHarmony()) {
             assertEquals(0, menu.getSubElements().length);
         } else {
             assertEquals(1, menu.getSubElements().length);
             assertTrue(menu.getSubElements()[0] instanceof JPopupMenu);
         }
-
         menu.add(item1);
         assertEquals(1, menu.getSubElements().length);
         assertTrue(menu.getSubElements()[0] instanceof JPopupMenu);
-
         menu.add(item2);
         assertEquals(1, menu.getSubElements().length);
         assertTrue(menu.getSubElements()[0] instanceof JPopupMenu);
-
         menu.addSeparator();
         assertEquals(1, menu.getSubElements().length);
         assertTrue(menu.getSubElements()[0] instanceof JPopupMenu);
-
         JButton button = new JButton();
         menu.add(button, 0);
         assertEquals(1, menu.getSubElements().length);
         assertTrue(menu.getSubElements()[0] instanceof JPopupMenu);
-
         JMenu subMenu = new JMenu();
         subMenu.add(item3);
         subMenu.add(item4);
@@ -503,16 +479,15 @@
     /*
      * Test method for 'javax.swing.JMenu.menuSelectionChanged(boolean)'
      */
+    @Override
     public void testMenuSelectionChanged() {
         ConcreteMenuListener listener = new ConcreteMenuListener();
         menu.addMenuListener(listener);
-
         menu.menuSelectionChanged(true);
         assertEquals("selected", listener.event);
         assertTrue(menu.getModel().isSelected());
         assertTrue(menu.isSelected());
         listener.event = null;
-
         menu.menuSelectionChanged(false);
         assertEquals("deselected", listener.event);
         assertFalse(menu.getModel().isSelected());
@@ -526,7 +501,6 @@
     public void testAddAction() {
         Icon icon = createNewIcon();
         String text = "texttext";
-
         Action action = new JPopupMenuTest.MyAction(text, icon);
         JMenuItem menuItem = menu.add(action);
         assertEquals(1, menu.getItemCount());
@@ -547,7 +521,6 @@
         assertNull(item1.getIcon());
         assertEquals(1, menu.getItemCount());
         assertSame(item1, menu.getItem(0));
-
         JMenuItem item2 = menu.add(text2);
         assertEquals(text2, item2.getText());
         assertNull(item2.getIcon());
@@ -564,14 +537,12 @@
         JMenuItem item1 = new JMenuItem();
         JMenuItem item2 = new JMenuItem();
         JPopupMenu popup = menu.getPopupMenu();
-
         JMenuItem item = menu.add(item1);
         assertEquals(0, menu.getComponentCount());
         assertEquals(1, menu.getItemCount());
         assertEquals(1, popup.getComponentCount());
         assertSame(item1, popup.getComponent(0));
         assertSame(item, item1);
-
         item = menu.add(item2);
         assertEquals(0, menu.getComponentCount());
         assertEquals(2, menu.getItemCount());
@@ -589,14 +560,12 @@
         Component item2 = new JMenuItem();
         Component item3 = new JButton();
         JPopupMenu popup = menu.getPopupMenu();
-
         Component item = menu.add(item1);
         assertEquals(0, menu.getComponentCount());
         assertEquals(1, menu.getItemCount());
         assertEquals(1, popup.getComponentCount());
         assertSame(item1, popup.getComponent(0));
         assertSame(item, item1);
-
         item = menu.add(item2);
         assertEquals(0, menu.getComponentCount());
         assertEquals(2, menu.getItemCount());
@@ -604,7 +573,6 @@
         assertSame(item1, popup.getComponent(0));
         assertSame(item2, popup.getComponent(1));
         assertSame(item, item2);
-
         item = menu.add(item3);
         assertEquals(0, menu.getComponentCount());
         assertEquals(3, menu.getItemCount());
@@ -623,14 +591,12 @@
         Component item2 = new JMenuItem();
         Component item3 = new JButton();
         JPopupMenu popup = menu.getPopupMenu();
-
         Component item = menu.add(item1, 0);
         assertEquals(0, menu.getComponentCount());
         assertEquals(1, menu.getItemCount());
         assertEquals(1, popup.getComponentCount());
         assertSame(item1, popup.getComponent(0));
         assertSame(item, item1);
-
         item = menu.add(item2, 1);
         assertEquals(0, menu.getComponentCount());
         assertEquals(2, menu.getItemCount());
@@ -638,7 +604,6 @@
         assertSame(item1, popup.getComponent(0));
         assertSame(item2, popup.getComponent(1));
         assertSame(item, item2);
-
         item = menu.add(item3, -1);
         assertEquals(0, menu.getComponentCount());
         assertEquals(3, menu.getItemCount());
@@ -656,21 +621,17 @@
         JMenuItem item1 = new JMenuItem();
         JMenuItem item2 = new JMenuItem();
         JPopupMenu popup = menu.getPopupMenu();
-
         menu.add(item1);
         assertEquals(1, menu.getItemCount());
         assertSame(item1, menu.getItem(0));
-
         menu.addSeparator();
         assertEquals(2, menu.getItemCount());
         assertTrue(popup.getComponent(1) instanceof JPopupMenu.Separator);
-
         menu.add(item2);
         assertEquals(3, menu.getItemCount());
         assertSame(item1, menu.getItem(0));
         assertNull(menu.getItem(1));
         assertSame(item2, menu.getItem(2));
-
         menu.addSeparator();
         assertEquals(4, menu.getItemCount());
         assertNull(menu.getItem(3));
@@ -685,30 +646,23 @@
         MenuListener listener1 = new ConcreteMenuListener();
         MenuListener listener2 = new ConcreteMenuListener();
         MenuListener listener3 = new ConcreteMenuListener();
-
         EventListener[] listenersArray = null;
-
         listenersArray = menu.getMenuListeners();
         int initialValue = listenersArray.length;
-
         menu.addMenuListener(listener1);
         menu.addMenuListener(listener2);
         menu.addMenuListener(listener2);
-
         listenersArray = menu.getMenuListeners();
         assertEquals(initialValue + 3, listenersArray.length);
-
         menu.removeMenuListener(listener1);
         menu.addMenuListener(listener3);
         menu.addMenuListener(listener3);
         listenersArray = menu.getMenuListeners();
         assertEquals(initialValue + 4, listenersArray.length);
-
         menu.removeMenuListener(listener3);
         menu.removeMenuListener(listener3);
         listenersArray = menu.getMenuListeners();
         assertEquals(initialValue + 2, listenersArray.length);
-
         menu.removeMenuListener(listener2);
         menu.removeMenuListener(listener2);
         listenersArray = menu.getMenuListeners();
@@ -738,7 +692,6 @@
         assertNotNull(l1);
         assertNotNull(l2);
         assertNotSame(l1, l2);
-
         action1.putValue(Action.NAME, text1);
         assertEquals(text1, menu.getText());
         assertEquals(text2, item1.getText());
@@ -755,22 +708,19 @@
     public void testCreateActionComponent() {
         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 = createNewIcon();
         String text = "texttext";
         MyAction action = new MyAction(text, icon);
         JMenuItem menuItem1 = menu.createActionComponent(action);
-
         assertEquals("icon ", icon, menuItem1.getIcon());
         assertEquals("text ", text, menuItem1.getText());
         assertNull("action", menuItem1.getAction());
@@ -778,7 +728,6 @@
         assertFalse("selected ", menuItem1.isSelected());
         assertTrue("enabled ", menuItem1.isEnabled());
         assertNull("accelerator ", menuItem1.getAccelerator());
-
         JMenuItem menuItem2 = menu.createActionComponent(action);
         assertNotSame(menuItem1, menuItem2);
         assertEquals("icon ", icon, menuItem2.getIcon());
@@ -810,7 +759,6 @@
         ConcreteMenuListener listener2 = new ConcreteMenuListener();
         menu.addMenuListener(listener1);
         menu.addMenuListener(listener2);
-
         menu.fireMenuCanceled();
         assertEquals("event fired properly ", "canceled", listener1.event);
         assertEquals("event fired properly ", "canceled", listener2.event);
@@ -826,7 +774,6 @@
         ConcreteMenuListener listener2 = new ConcreteMenuListener();
         menu.addMenuListener(listener1);
         menu.addMenuListener(listener2);
-
         menu.fireMenuDeselected();
         assertEquals("event fired properly ", "deselected", listener1.event);
         assertEquals("event fired properly ", "deselected", listener2.event);
@@ -842,7 +789,6 @@
         ConcreteMenuListener listener2 = new ConcreteMenuListener();
         menu.addMenuListener(listener1);
         menu.addMenuListener(listener2);
-
         menu.fireMenuSelected();
         assertEquals("event fired properly ", "selected", listener1.event);
         assertEquals("event fired properly ", "selected", listener2.event);
@@ -900,7 +846,6 @@
         assertEquals(item1, menu.getMenuComponent(0));
         assertEquals(item2, menu.getMenuComponent(1));
         assertTrue(menu.getMenuComponent(2) instanceof JSeparator);
-
         menu.add(new JButton(), 3);
         assertEquals(item1, menu.getMenuComponent(0));
         assertEquals(item2, menu.getMenuComponent(1));
@@ -924,7 +869,6 @@
         assertEquals(item1, menu.getItem(0));
         assertEquals(item2, menu.getItem(1));
         assertNull(menu.getItem(2));
-
         menu.add(new JButton(), 3);
         assertEquals(item1, menu.getMenuComponent(0));
         assertEquals(item2, menu.getMenuComponent(1));
@@ -940,24 +884,19 @@
         JMenuItem item2 = new JMenuItem();
         JMenuItem item3 = new JMenuItem();
         JMenuItem item4 = new JMenuItem();
-
         assertEquals(0, menu.getMenuComponents().length);
-
         menu.add(item1);
         assertEquals(1, menu.getMenuComponents().length);
         assertSame(item1, menu.getMenuComponents()[0]);
-
         menu.add(item2);
         assertEquals(2, menu.getMenuComponents().length);
         assertSame(item1, menu.getMenuComponents()[0]);
         assertSame(item2, menu.getMenuComponents()[1]);
-
         menu.addSeparator();
         assertEquals(3, menu.getMenuComponents().length);
         assertSame(item1, menu.getMenuComponents()[0]);
         assertSame(item2, menu.getMenuComponents()[1]);
         assertTrue(menu.getMenuComponents()[2] instanceof JSeparator);
-
         JButton button = new JButton();
         menu.add(button, 0);
         assertEquals(4, menu.getMenuComponents().length);
@@ -965,7 +904,6 @@
         assertSame(item1, menu.getMenuComponents()[1]);
         assertSame(item2, menu.getMenuComponents()[2]);
         assertTrue(menu.getMenuComponents()[3] instanceof JSeparator);
-
         JMenu subMenu = new JMenu();
         subMenu.add(item3);
         subMenu.add(item4);
@@ -1008,14 +946,13 @@
         UIManager.put("Menu.menuPopupOffsetY", new Integer(offsetY1));
         UIManager.put("Menu.submenuPopupOffsetX", new Integer(offsetX2));
         UIManager.put("Menu.submenuPopupOffsetY", new Integer(offsetY2));
-
         frame.setVisible(true);
-        assertEquals(new Point(offsetX1, menu.getHeight() + offsetY1), menu.getPopupMenuOrigin());
+        assertEquals(new Point(offsetX1, menu.getHeight() + offsetY1), menu
+                .getPopupMenuOrigin());
         frame.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
-        assertEquals(new Point(menu.getWidth() - menu.getPopupMenu().getPreferredSize().width - offsetX1,
-                               menu.getHeight() + offsetY1), menu.getPopupMenuOrigin());
+        assertEquals(new Point(menu.getWidth() - menu.getPopupMenu().getPreferredSize().width
+                - offsetX1, menu.getHeight() + offsetY1), menu.getPopupMenuOrigin());
         menuBar.remove(menu);
-
         menuBar.add(menu2);
         menu2.add(menu);
         frame.pack();
@@ -1023,7 +960,8 @@
         menu2.setPopupMenuVisible(true);
         assertEquals(new Point(menu.getWidth() + offsetX2, offsetY2), menu.getPopupMenuOrigin());
         frame.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
-        assertEquals(new Point(-offsetX2 - menu.getPopupMenu().getPreferredSize().width , offsetY2), menu.getPopupMenuOrigin());
+        assertEquals(new Point(-offsetX2 - menu.getPopupMenu().getPreferredSize().width,
+                offsetY2), menu.getPopupMenuOrigin());
         frame.dispose();
     }
 
@@ -1039,7 +977,6 @@
         assertNull(item1.getIcon());
         assertEquals(1, menu.getItemCount());
         assertEquals(item1, menu.getItem(0));
-
         menu.insert(text2, 0);
         JMenuItem item2 = menu.getItem(0);
         assertEquals(text2, item2.getText());
@@ -1048,12 +985,11 @@
         assertEquals(item2, menu.getItem(0));
         assertEquals(item1, menu.getItem(1));
         assertNotSame(item1, item2);
-
         try {
             menu.insert(text1, -6);
             fail("no exception has been thrown");
-        } catch (IllegalArgumentException e) {}
-
+        } catch (IllegalArgumentException e) {
+        }
         menu.insert(text1, 5);
         assertEquals(3, menu.getItemCount());
         item1 = menu.getItem(2);
@@ -1070,18 +1006,16 @@
         assertSame(item1, menu.insert(item1, 0));
         assertEquals(1, menu.getItemCount());
         assertEquals(item1, menu.getItem(0));
-
         assertSame(item2, menu.insert(item2, 0));
         assertEquals(2, menu.getItemCount());
         assertEquals(item2, menu.getItem(0));
         assertEquals(item1, menu.getItem(1));
         assertNotSame(item1, item2);
-
         try {
             menu.insert(item1, -6);
             fail("no exception has been thrown");
-        } catch (IllegalArgumentException e) {}
-
+        } catch (IllegalArgumentException e) {
+        }
         menu.insert(item1, 5);
         assertEquals(2, menu.getItemCount());
     }
@@ -1092,36 +1026,30 @@
     public void testInsertActionInt() {
         Icon icon = createNewIcon();
         String text = "texttext";
-
         MyAction action1 = new MyAction(text, icon);
         MyAction action2 = new MyAction(text, icon);
-
         JMenuItem item = menu.insert(action1, 0);
         assertEquals(1, menu.getItemCount());
         JMenuItem menuItem = menu.getItem(0);
         assertSame(item, menuItem);
         assertEquals("icon ", icon, menuItem.getIcon());
         assertEquals("text ", text, menuItem.getText());
-
         item = menu.insert(action2, 1);
         assertEquals(2, menu.getItemCount());
-
         menuItem = menu.getItem(1);
         assertSame(item, menuItem);
         assertEquals("icon ", icon, menuItem.getIcon());
         assertEquals("text ", text, menuItem.getText());
-
         menu.insert(action1, 16);
         assertEquals(3, menu.getItemCount());
-
         menuItem = menu.getItem(2);
         assertEquals("icon ", icon, menuItem.getIcon());
         assertEquals("text ", text, menuItem.getText());
-
         try {
             menu.insert(action1, -3);
             fail("no exception has been thrown");
-        } catch (IllegalArgumentException e) {}
+        } catch (IllegalArgumentException e) {
+        }
     }
 
     /*
@@ -1132,19 +1060,17 @@
         assertEquals(1, menu.getItemCount());
         assertNull(menu.getItem(0));
         assertTrue(menu.getPopupMenu().getComponent(0) instanceof JSeparator);
-
         menu.insertSeparator(0);
         assertEquals(2, menu.getItemCount());
         assertNull(menu.getItem(0));
         assertNull(menu.getItem(1));
         assertTrue(menu.getPopupMenu().getComponent(0) instanceof JSeparator);
         assertTrue(menu.getPopupMenu().getComponent(1) instanceof JSeparator);
-
         try {
             menu.insertSeparator(-6);
             fail("no exception has been thrown");
-        } catch (IllegalArgumentException e) {}
-
+        } catch (IllegalArgumentException e) {
+        }
         menu.insertSeparator(5);
         assertEquals(3, menu.getItemCount());
     }
@@ -1157,32 +1083,26 @@
         JMenuItem item2 = new JMenuItem();
         JMenuItem item3 = new JMenuItem();
         JMenuItem item4 = new JMenuItem();
-
         assertFalse(menu.isMenuComponent(item1));
         assertTrue(menu.isMenuComponent(menu));
-
         menu.add(item1);
         assertTrue(menu.isMenuComponent(item1));
         assertTrue(menu.isMenuComponent(menu));
         assertFalse(menu.isMenuComponent(item2));
-
         menu.add(item2);
         assertTrue(menu.isMenuComponent(item2));
         assertTrue(menu.isMenuComponent(item1));
         assertTrue(menu.isMenuComponent(menu));
-
         menu.addSeparator();
         assertTrue(menu.isMenuComponent(item2));
         assertTrue(menu.isMenuComponent(item1));
         assertTrue(menu.isMenuComponent(menu));
-
         JButton button = new JButton();
         menu.add(button, 0);
         assertTrue(menu.isMenuComponent(button));
         assertTrue(menu.isMenuComponent(item2));
         assertTrue(menu.isMenuComponent(item1));
         assertTrue(menu.isMenuComponent(menu));
-
         JMenu subMenu = new JMenu();
         subMenu.add(item3);
         subMenu.add(item4);
@@ -1194,7 +1114,6 @@
         assertTrue(menu.isMenuComponent(item2));
         assertTrue(menu.isMenuComponent(item1));
         assertTrue(menu.isMenuComponent(menu));
-
         assertFalse(menu.isMenuComponent(null));
     }
 
@@ -1205,7 +1124,8 @@
         try {
             menu.isTearOff();
             fail("no exception has been thrown");
-        } catch (Error e) {}
+        } catch (Error e) {
+        }
     }
 
     /*
@@ -1228,15 +1148,14 @@
     public void testGetSetDelay() {
         int delay1 = 1000;
         int delay2 = -1000;
-
         menu.setDelay(0);
         menu.setDelay(delay1);
         assertEquals("delay", delay1, menu.getDelay());
-
         try {
             menu.setDelay(delay2);
             fail("no exception has been thrown");
-        } catch (IllegalArgumentException e) {}
+        } catch (IllegalArgumentException e) {
+        }
     }
 
     /*
@@ -1257,7 +1176,6 @@
     public void testSetIsPopupMenuVisible() throws InterruptedException {
         menu.setPopupMenuVisible(true);
         assertFalse(menu.isPopupMenuVisible());
-
         JWindow frame = new JWindow();
         frame.setLocation(300, 300);
         menu.setPreferredSize(new Dimension(200, 200));
@@ -1273,15 +1191,15 @@
         Point menuLocation = menu.getLocationOnScreen();
         menuLocation.translate(0, menu.getHeight());
         assertEquals(menuLocation, menu.getPopupMenu().getLocationOnScreen());
-
         menu.setPopupMenuVisible(false);
         assertFalse(menu.isPopupMenuVisible());
         frame.dispose();
     }
 
+    @Override
     public void testNumberOfModelListeners() {
         button.setUI(null);
-        DefaultButtonModel model = (DefaultButtonModel)button.getModel();
+        DefaultButtonModel model = (DefaultButtonModel) button.getModel();
         assertEquals("model's action listeners ", 1, model.getActionListeners().length);
         assertEquals("model's item listeners ", 1, model.getItemListeners().length);
         if (isHarmony()) {
@@ -1291,6 +1209,7 @@
         }
     }
 
+    @Override
     public void testConfigurePropertiesFromAction() {
         Icon icon1 = createNewIcon();
         Icon icon2 = createNewIcon();
@@ -1312,7 +1231,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());
@@ -1320,14 +1238,12 @@
         button.isEnabled();
         assertFalse("enabled ", button.isEnabled());
         assertFalse("enabled ", action1.isEnabled());
-
         assertEquals("icon ", icon1, button.getIcon());
         action1.putValue(Action.SMALL_ICON, icon2);
         assertEquals("icon ", icon2, button.getIcon());
         button.setIcon(icon2);
         action1.putValue(Action.SMALL_ICON, null);
         assertNull("icon ", button.getIcon());
-
         if (isHarmony()) {
             assertEquals("mnemonic ", 1, button.getMnemonic());
             action1.putValue(Action.MNEMONIC_KEY, new Integer(27));
@@ -1335,17 +1251,14 @@
             action1.putValue(Action.ACCELERATOR_KEY, ks1);
             assertNull("accelerator ", menuItem.getAccelerator());
         }
-
         assertEquals("text ", text1, button.getText());
         action1.putValue(Action.NAME, text2);
         assertEquals("text ", text2, button.getText());
-
         if (isHarmony()) {
             assertEquals("ToolTipText ", text3, button.getToolTipText());
             action1.putValue(Action.SHORT_DESCRIPTION, text4);
             assertEquals("ToolTipText ", text4, button.getToolTipText());
         }
-
         action2.putValue(Action.ACCELERATOR_KEY, ks2);
         button.setAction(action2);
         action1.putValue(Action.SHORT_DESCRIPTION, text4);
@@ -1355,7 +1268,5 @@
             assertEquals("ToolTipText ", text4, button.getToolTipText());
             assertNull("accelerator ", menuItem.getAccelerator());
         }
-
     }
-
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JOptionPaneTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JOptionPaneTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JOptionPaneTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JOptionPaneTest.java Sat Nov 25 16:04:10 2006
@@ -25,28 +25,28 @@
 import java.awt.Dimension;
 import java.awt.Frame;
 import java.awt.image.BufferedImage;
-
 import javax.accessibility.AccessibleRole;
 import javax.swing.plaf.OptionPaneUI;
 
 public class JOptionPaneTest extends SwingTestCase {
-
     JOptionPane pane = null;
 
     /*
      * @see TestCase#setUp()
      */
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         pane = new JOptionPane();
     }
 
     public void testGetAccessibleContext() {
-        boolean assertedValue = (pane.getAccessibleContext() != null &&
-                pane.getAccessibleContext().getClass().getName().equals("javax.swing.JOptionPane$AccessibleJOptionPane"));
-
-        assertTrue("AccessibleContext created properly ",  assertedValue);
-        assertEquals("AccessibleRole", AccessibleRole.OPTION_PANE, pane.getAccessibleContext().getAccessibleRole());
+        boolean assertedValue = (pane.getAccessibleContext() != null && pane
+                .getAccessibleContext().getClass().getName().equals(
+                        "javax.swing.JOptionPane$AccessibleJOptionPane"));
+        assertTrue("AccessibleContext created properly ", assertedValue);
+        assertEquals("AccessibleRole", AccessibleRole.OPTION_PANE, pane.getAccessibleContext()
+                .getAccessibleRole());
     }
 
     public void testParamString() {
@@ -59,17 +59,17 @@
 
     public void testUpdateUI() {
         OptionPaneUI ui = new OptionPaneUI() {
+            @Override
             public void selectInitialValue(JOptionPane arg0) {
             }
 
+            @Override
             public boolean containsCustomComponents(JOptionPane arg0) {
                 return false;
             }
         };
-
         pane.setUI(ui);
         assertEquals(ui, pane.getUI());
-
         pane.updateUI();
         assertNotSame(ui, pane.getUI());
     }
@@ -85,7 +85,6 @@
         assertTrue("options", pane.getOptions() == null || pane.getOptions().length == 0);
         assertNull("initial value", pane.getInitialValue());
         assertEquals("input value", JOptionPane.UNINITIALIZED_VALUE, pane.getInputValue());
-
         assertEquals(1, pane.getPropertyChangeListeners().length);
     }
 
@@ -111,7 +110,6 @@
         String message = "message";
         int messageType1 = JOptionPane.ERROR_MESSAGE;
         int messageType2 = -100;
-
         pane = new JOptionPane(message, messageType1);
         assertEquals("message", message, pane.getMessage());
         assertEquals("message type", messageType1, pane.getMessageType());
@@ -120,11 +118,10 @@
         assertTrue("options", pane.getOptions() == null || pane.getOptions().length == 0);
         assertNull("initial value", pane.getInitialValue());
         assertEquals("input value", JOptionPane.UNINITIALIZED_VALUE, pane.getInputValue());
-
         boolean thrown = false;
         try {
             pane = new JOptionPane(message, messageType2);
-        } catch(RuntimeException e) {
+        } catch (RuntimeException e) {
             thrown = true;
         }
         assertTrue("exception thrown", thrown);
@@ -139,7 +136,6 @@
         int messageType2 = -100;
         int optionType1 = JOptionPane.CANCEL_OPTION;
         int optionType2 = -100;
-
         pane = new JOptionPane(message, messageType1, optionType1);
         assertEquals("message", message, pane.getMessage());
         assertEquals("message type", messageType1, pane.getMessageType());
@@ -148,19 +144,17 @@
         assertTrue("options", pane.getOptions() == null || pane.getOptions().length == 0);
         assertNull("initial value", pane.getInitialValue());
         assertEquals("input value", JOptionPane.UNINITIALIZED_VALUE, pane.getInputValue());
-
         boolean thrown = false;
         try {
             pane = new JOptionPane(message, messageType2, optionType1);
-        } catch(RuntimeException e) {
+        } catch (RuntimeException e) {
             thrown = true;
         }
         assertTrue("exception thrown", thrown);
-
         thrown = false;
         try {
             pane = new JOptionPane(message, messageType1, optionType2);
-        } catch(RuntimeException e) {
+        } catch (RuntimeException e) {
             thrown = true;
         }
         assertTrue("exception thrown", thrown);
@@ -177,7 +171,6 @@
         int messageType2 = -100;
         int optionType1 = JOptionPane.CANCEL_OPTION;
         int optionType2 = -100;
-
         pane = new JOptionPane(message, messageType1, optionType1, icon1);
         assertEquals("message", message, pane.getMessage());
         assertEquals("message type", messageType1, pane.getMessageType());
@@ -186,27 +179,24 @@
         assertTrue("options", pane.getOptions() == null || pane.getOptions().length == 0);
         assertNull("initial value", pane.getInitialValue());
         assertEquals("input value", JOptionPane.UNINITIALIZED_VALUE, pane.getInputValue());
-
         boolean thrown = false;
         try {
             pane = new JOptionPane(message, messageType2, optionType1, icon1);
-        } catch(RuntimeException e) {
+        } catch (RuntimeException e) {
             thrown = true;
         }
         assertTrue("exception's been thrown", thrown);
-
         thrown = false;
         try {
             pane = new JOptionPane(message, messageType1, optionType2, icon1);
-        } catch(RuntimeException e) {
+        } catch (RuntimeException e) {
             thrown = true;
         }
         assertTrue("exception's been thrown", thrown);
-
         thrown = false;
         try {
             pane = new JOptionPane(message, messageType1, optionType1, icon2);
-        } catch(RuntimeException e) {
+        } catch (RuntimeException e) {
             thrown = true;
         }
         assertFalse("exception's not been thrown", thrown);
@@ -223,9 +213,8 @@
         int messageType2 = -100;
         int optionType1 = JOptionPane.CANCEL_OPTION;
         int optionType2 = -100;
-        Object[] options1 = new Object[] {new JPanel(), "message"};
-        Object[] options2 = new Object[] {new InputMap(), new ActionMap()};
-
+        Object[] options1 = new Object[] { new JPanel(), "message" };
+        Object[] options2 = new Object[] { new InputMap(), new ActionMap() };
         pane = new JOptionPane(message, messageType1, optionType1, icon1, options1);
         assertEquals("message", message, pane.getMessage());
         assertEquals("message type", messageType1, pane.getMessageType());
@@ -236,35 +225,31 @@
         assertEquals("options", options1[1], pane.getOptions()[1]);
         assertNull("initial value", pane.getInitialValue());
         assertEquals("input value", JOptionPane.UNINITIALIZED_VALUE, pane.getInputValue());
-
         boolean thrown = false;
         try {
             pane = new JOptionPane(message, messageType2, optionType1, icon1, options1);
-        } catch(RuntimeException e) {
+        } catch (RuntimeException e) {
             thrown = true;
         }
         assertTrue("exception's been thrown", thrown);
-
         thrown = false;
         try {
             pane = new JOptionPane(message, messageType1, optionType2, icon1, options1);
-        } catch(RuntimeException e) {
+        } catch (RuntimeException e) {
             thrown = true;
         }
         assertTrue("exception's been thrown", thrown);
-
         thrown = false;
         try {
             pane = new JOptionPane(message, messageType1, optionType1, icon2, options1);
-        } catch(RuntimeException e) {
+        } catch (RuntimeException e) {
             thrown = true;
         }
         assertFalse("exception's not been thrown", thrown);
-
         thrown = false;
         try {
             pane = new JOptionPane(message, messageType1, optionType1, icon1, options2);
-        } catch(RuntimeException e) {
+        } catch (RuntimeException e) {
             thrown = true;
         }
         assertFalse("exception's not been thrown", thrown);
@@ -282,10 +267,10 @@
         int optionType1 = JOptionPane.CANCEL_OPTION;
         int optionType2 = -100;
         Object initialSelection = "asdasd";
-        Object[] options1 = new Object[] {new JPanel(), initialSelection};
-        Object[] options2 = new Object[] {new InputMap(), initialSelection};
-
-        pane = new JOptionPane(message, messageType1, optionType1, icon1, options1, initialSelection);
+        Object[] options1 = new Object[] { new JPanel(), initialSelection };
+        Object[] options2 = new Object[] { new InputMap(), initialSelection };
+        pane = new JOptionPane(message, messageType1, optionType1, icon1, options1,
+                initialSelection);
         assertEquals("message", message, pane.getMessage());
         assertEquals("message type", messageType1, pane.getMessageType());
         assertEquals("option type", optionType1, pane.getOptionType());
@@ -295,31 +280,30 @@
         assertEquals("options", options1[1], pane.getOptions()[1]);
         assertEquals("initial value", initialSelection, pane.getInitialValue());
         assertEquals("input value", JOptionPane.UNINITIALIZED_VALUE, pane.getInputValue());
-
         boolean thrown = false;
         try {
-            pane = new JOptionPane(message, messageType2, optionType1, icon1, options1, initialSelection);
-        } catch(RuntimeException e) {
+            pane = new JOptionPane(message, messageType2, optionType1, icon1, options1,
+                    initialSelection);
+        } catch (RuntimeException e) {
             thrown = true;
         }
         assertTrue("exception's been thrown", thrown);
-
         thrown = false;
         try {
-            pane = new JOptionPane(message, messageType1, optionType2, icon1, options1, initialSelection);
-        } catch(RuntimeException e) {
+            pane = new JOptionPane(message, messageType1, optionType2, icon1, options1,
+                    initialSelection);
+        } catch (RuntimeException e) {
             thrown = true;
         }
         assertTrue("exception's been thrown", thrown);
-
         thrown = false;
         try {
-            pane = new JOptionPane(message, messageType1, optionType1, icon2, options1, initialSelection);
-        } catch(RuntimeException e) {
+            pane = new JOptionPane(message, messageType1, optionType1, icon2, options1,
+                    initialSelection);
+        } catch (RuntimeException e) {
             thrown = true;
         }
         assertFalse("exception's not been thrown", thrown);
-
         pane = new JOptionPane(message, messageType1, optionType1, icon1, options2, null);
         assertEquals("message", message, pane.getMessage());
         assertEquals("message type", messageType1, pane.getMessageType());
@@ -329,8 +313,8 @@
         assertEquals("options", options2[0], pane.getOptions()[0]);
         assertEquals("options", options2[1], pane.getOptions()[1]);
         assertNull("initial value", pane.getInitialValue());
-
-        pane = new JOptionPane(message, messageType1, optionType1, icon1, null, initialSelection);
+        pane = new JOptionPane(message, messageType1, optionType1, icon1, null,
+                initialSelection);
         assertEquals("message", message, pane.getMessage());
         assertEquals("message type", messageType1, pane.getMessageType());
         assertEquals("option type", optionType1, pane.getOptionType());
@@ -443,43 +427,40 @@
         boolean thrown = false;
         try {
             iFrame = pane.createInternalFrame(panel, title);
-        } catch(RuntimeException e) {
-            assertEquals("message", "JOptionPane: parentComponent does not have a valid parent", e.getMessage());
+        } catch (RuntimeException e) {
+            assertEquals("message",
+                    "JOptionPane: parentComponent does not have a valid parent", e.getMessage());
             thrown = true;
         }
         assertTrue("runtime exception's been thrown", thrown);
-
         frame.getContentPane().add(panel);
         iFrame = pane.createInternalFrame(panel, title);
         assertEquals("title", title, iFrame.getTitle());
         assertEquals("parent", panel.getParent(), iFrame.getParent());
-        assertEquals("pane", pane, ((JPanel)iFrame.getRootPane().getLayeredPane().
-                                                getComponent(0)).getComponent(0));
-
+        assertEquals("pane", pane, ((JPanel) iFrame.getRootPane().getLayeredPane()
+                .getComponent(0)).getComponent(0));
         deskTop.add(panel);
         iFrame = pane.createInternalFrame(panel, title);
         assertEquals("title", title, iFrame.getTitle());
         assertEquals("parent", deskTop, iFrame.getParent());
-        assertEquals("pane", pane,
-                     ((JPanel)((JLayeredPane)((JRootPane)iFrame.getComponent(0)).getComponent(1)).
-                             getComponent(0)).getComponent(0));
+        assertEquals("pane", pane, ((JPanel) ((JLayeredPane) ((JRootPane) iFrame
+                .getComponent(0)).getComponent(1)).getComponent(0)).getComponent(0));
         frame.dispose();
     }
 
     public void testCreateDialog() {
-      JFrame frame = new JFrame();
-      JPanel panel = new JPanel();
-      String title = "title-title";
-      panel.setPreferredSize(new Dimension(300, 300));
-      frame.getContentPane().add(panel);
-      JDialog dialog = pane.createDialog(panel, title);
-      assertEquals("title", title, dialog.getTitle());
-      assertFalse("resizable", dialog.isResizable());
-      assertEquals("pane", pane,
-                   ((JPanel)((JLayeredPane)((JRootPane)dialog.getComponent(0)).getComponent(1)).
-                           getComponent(0)).getComponent(0));
-      assertTrue(dialog.isModal());
-      frame.dispose();
+        JFrame frame = new JFrame();
+        JPanel panel = new JPanel();
+        String title = "title-title";
+        panel.setPreferredSize(new Dimension(300, 300));
+        frame.getContentPane().add(panel);
+        JDialog dialog = pane.createDialog(panel, title);
+        assertEquals("title", title, dialog.getTitle());
+        assertFalse("resizable", dialog.isResizable());
+        assertEquals("pane", pane, ((JPanel) ((JLayeredPane) ((JRootPane) dialog
+                .getComponent(0)).getComponent(1)).getComponent(0)).getComponent(0));
+        assertTrue(dialog.isModal());
+        frame.dispose();
     }
 
     /*
@@ -487,13 +468,13 @@
      */
     public void testShowInternalMessageDialogComponentObject() {
         //TODO Implement showInternalMessageDialog().
-//        JFrame frame = new JFrame();
-//        JPanel panel = new JPanel();
-//        panel.setPreferredSize(new Dimension(300, 300));
-//        frame.getContentPane().add(panel);
-//        frame.pack();
-//        frame.setVisible(true);
-//        JOptionPane.showInternalMessageDialog(frame.getContentPane(), "Bom shankar!");
+        //        JFrame frame = new JFrame();
+        //        JPanel panel = new JPanel();
+        //        panel.setPreferredSize(new Dimension(300, 300));
+        //        frame.getContentPane().add(panel);
+        //        frame.pack();
+        //        frame.setVisible(true);
+        //        JOptionPane.showInternalMessageDialog(frame.getContentPane(), "Bom shankar!");
     }
 
     /*
@@ -568,13 +549,11 @@
         JPanel panel = new JPanel();
         JFrame frame = new JFrame();
         JFrame rootFrame = new JFrame();
-        String title = "title-title";
         assertEquals("frame", defaultFrame, JOptionPane.getFrameForComponent(null));
         assertEquals("frame", defaultFrame, JOptionPane.getFrameForComponent(panel));
         frame.getContentPane().add(panel);
         assertEquals("frame", frame, JOptionPane.getFrameForComponent(panel));
         assertEquals("frame", frame, JOptionPane.getFrameForComponent(frame));
-
         JOptionPane.setRootFrame(rootFrame);
         assertEquals("frame", rootFrame, JOptionPane.getFrameForComponent(null));
         assertEquals("frame", frame, JOptionPane.getFrameForComponent(panel));
@@ -585,7 +564,6 @@
     public void testGetDesktopPaneForComponent() {
         JPanel panel = new JPanel();
         JDesktopPane frame = new JDesktopPane();
-        String title = "title-title";
         assertNull("frame", JOptionPane.getDesktopPaneForComponent(null));
         assertNull("frame", JOptionPane.getDesktopPaneForComponent(panel));
         frame.add(panel);
@@ -595,13 +573,10 @@
     public void testSetRootFrame() {
         Frame frame1 = new Frame();
         Frame frame2 = new JFrame();
-
         JOptionPane.setRootFrame(frame1);
         assertEquals("root frame ", frame1, JOptionPane.getRootFrame());
-
         JOptionPane.setRootFrame(frame2);
         assertEquals("root frame ", frame2, JOptionPane.getRootFrame());
-
         JOptionPane.setRootFrame(null);
         frame1.dispose();
         frame2.dispose();
@@ -628,23 +603,18 @@
     }
 
     public void testSetMessage() {
-        PropertyChangeController listener1 =  new PropertyChangeController();
+        PropertyChangeController listener1 = new PropertyChangeController();
         String message1 = "message1";
         String message2 = "message2";
-
         pane.addPropertyChangeListener(listener1);
         pane.setMessage(message1);
-        listener1.checkPropertyFired(pane, "message",
-                           "JOptionPane message", message1);
+        listener1.checkPropertyFired(pane, "message", "JOptionPane message", message1);
         assertEquals("message", message1, pane.getMessage());
         listener1.reset();
-
         pane.setMessage(message2);
-        listener1.checkPropertyFired(pane, "message",
-                           message1, message2);
+        listener1.checkPropertyFired(pane, "message", message1, message2);
         assertEquals("message", message2, pane.getMessage());
         listener1.reset();
-
         pane.setMessage(message2);
         assertFalse("event's not been fired ", listener1.isChanged());
         listener1.reset();
@@ -657,23 +627,19 @@
     public void testSetIcon() {
         Icon icon1 = new ImageIcon(new BufferedImage(20, 20, BufferedImage.TYPE_BYTE_GRAY));
         Icon icon2 = new ImageIcon(new BufferedImage(20, 20, BufferedImage.TYPE_BYTE_GRAY));
-        PropertyChangeController listener1 =  new PropertyChangeController();
-
+        PropertyChangeController listener1 = new PropertyChangeController();
         pane.addPropertyChangeListener(listener1);
         pane.setIcon(icon1);
         listener1.checkPropertyFired(pane, "icon", null, icon1);
         assertEquals("icon", icon1, pane.getIcon());
         listener1.reset();
-
         pane.setIcon(icon2);
         listener1.checkPropertyFired(pane, "icon", icon1, icon2);
         assertEquals("icon", icon2, pane.getIcon());
         listener1.reset();
-
         pane.setIcon(icon2);
         assertFalse("event's not been fired ", listener1.isChanged());
         listener1.reset();
-
         pane.setIcon(null);
         listener1.checkPropertyFired(pane, "icon", icon2, null);
         assertNull("icon", pane.getIcon());
@@ -687,21 +653,14 @@
     public void testSetValue() {
         JButton button1 = new JButton("1");
         JButton button2 = new JButton("2");
-
-        PropertyChangeController listener1 =  new PropertyChangeController();
-
+        PropertyChangeController listener1 = new PropertyChangeController();
         pane.addPropertyChangeListener(listener1);
         pane.setValue(button1);
-        listener1.checkPropertyFired(pane, "value",
-                                     JOptionPane.UNINITIALIZED_VALUE,
-                                     button1);
+        listener1.checkPropertyFired(pane, "value", JOptionPane.UNINITIALIZED_VALUE, button1);
         assertEquals("value", button1, pane.getValue());
-
         listener1.reset();
         pane.setValue(button2);
-        listener1.checkPropertyFired(pane, "value",
-                                     button1,
-                                     button2);
+        listener1.checkPropertyFired(pane, "value", button1, button2);
         assertEquals("value", button2, pane.getValue());
     }
 
@@ -711,32 +670,24 @@
 
     public void testSetOptions() {
         Object options2[] = new Object[] { new JButton("1"), new ImageIcon(), "asdasd" };
-        Object options22[] = (Object[])options2.clone();
+        Object options22[] = options2.clone();
         Object options3[] = new Object[] { "asd", new InputMap(), new JPanel() };
-        Object options32[] = (Object[])options3.clone();
-
-        PropertyChangeController listener1 =  new PropertyChangeController();
-
+        Object options32[] = options3.clone();
+        PropertyChangeController listener1 = new PropertyChangeController();
         pane.addPropertyChangeListener(listener1);
         pane.setOptions(options2);
-        listener1.checkPropertyFired(pane, "options",
-                                     null,
-                                     options2);
+        listener1.checkPropertyFired(pane, "options", null, options2);
         assertTrue("unique", options2 != pane.getOptions());
         assertEquals("options", options22.length, pane.getOptions().length);
         assertEquals("options", options22[0], pane.getOptions()[0]);
         assertEquals("options", options22[1], pane.getOptions()[1]);
         assertEquals("options", options22[2], pane.getOptions()[2]);
-
         pane.setOptions(options3);
-        listener1.checkPropertyFired(pane, "options",
-                                     options2,
-                                     options3);
+        listener1.checkPropertyFired(pane, "options", options2, options3);
         assertEquals("options", options32.length, pane.getOptions().length);
         assertEquals("options", options32[0], pane.getOptions()[0]);
         assertEquals("options", options32[1], pane.getOptions()[1]);
         assertEquals("options", options32[2], pane.getOptions()[2]);
-
         listener1.reset();
         pane.setOptions(options3);
         assertFalse("event's not been fired ", listener1.isChanged());
@@ -749,23 +700,16 @@
     public void testSetInitialValue() {
         JButton button1 = new JButton("1");
         JButton button2 = new JButton("2");
-
         pane.setWantsInput(false);
-        PropertyChangeController listener1 =  new PropertyChangeController();
-
+        PropertyChangeController listener1 = new PropertyChangeController();
         pane.addPropertyChangeListener(listener1);
         pane.setInitialValue(button1);
-        listener1.checkPropertyFired(pane, "initialValue",
-                                     null,
-                                     button1);
+        listener1.checkPropertyFired(pane, "initialValue", null, button1);
         assertEquals("InitialValue", button1, pane.getInitialValue());
-
         pane.setWantsInput(true);
         listener1.reset();
         pane.setInitialValue(button2);
-        listener1.checkPropertyFired(pane, "initialValue",
-                                     button1,
-                                     button2);
+        listener1.checkPropertyFired(pane, "initialValue", button1, button2);
         assertEquals("InitialValue", button2, pane.getInitialValue());
     }
 
@@ -774,25 +718,19 @@
     }
 
     public void testSetMessageType() {
-        PropertyChangeController listener1 =  new PropertyChangeController();
-
+        PropertyChangeController listener1 = new PropertyChangeController();
         pane.addPropertyChangeListener(listener1);
         pane.setMessageType(JOptionPane.ERROR_MESSAGE);
         listener1.checkPropertyFired(pane, "messageType",
-                           new Integer(JOptionPane.PLAIN_MESSAGE),
-                           new Integer(JOptionPane.ERROR_MESSAGE));
-        assertEquals("message type", JOptionPane.ERROR_MESSAGE,
-                     pane.getMessageType());
+                new Integer(JOptionPane.PLAIN_MESSAGE), new Integer(JOptionPane.ERROR_MESSAGE));
+        assertEquals("message type", JOptionPane.ERROR_MESSAGE, pane.getMessageType());
         listener1.reset();
-
         pane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
         listener1.checkPropertyFired(pane, "messageType",
-                                   new Integer(JOptionPane.ERROR_MESSAGE),
-                                   new Integer(JOptionPane.INFORMATION_MESSAGE));
-        assertEquals("message type", JOptionPane.INFORMATION_MESSAGE,
-                     pane.getMessageType());
+                new Integer(JOptionPane.ERROR_MESSAGE), new Integer(
+                        JOptionPane.INFORMATION_MESSAGE));
+        assertEquals("message type", JOptionPane.INFORMATION_MESSAGE, pane.getMessageType());
         listener1.reset();
-
         boolean thrown = false;
         try {
             pane.setMessageType(100);
@@ -800,37 +738,28 @@
             thrown = true;
         }
         assertTrue("exception is thrown", thrown);
-
         pane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
         assertFalse("event's not been fired ", listener1.isChanged());
         listener1.reset();
     }
 
     public void testGetMessageType() {
-        assertEquals("message type", JOptionPane.PLAIN_MESSAGE,
-                     pane.getMessageType());
+        assertEquals("message type", JOptionPane.PLAIN_MESSAGE, pane.getMessageType());
     }
 
     public void testSetOptionType() {
-        PropertyChangeController listener1 =  new PropertyChangeController();
-
+        PropertyChangeController listener1 = new PropertyChangeController();
         pane.addPropertyChangeListener(listener1);
         pane.setOptionType(JOptionPane.CANCEL_OPTION);
         listener1.checkPropertyFired(pane, "optionType",
-                           new Integer(JOptionPane.CLOSED_OPTION),
-                           new Integer(JOptionPane.CANCEL_OPTION));
-        assertEquals("option type", JOptionPane.CANCEL_OPTION,
-                     pane.getOptionType());
+                new Integer(JOptionPane.CLOSED_OPTION), new Integer(JOptionPane.CANCEL_OPTION));
+        assertEquals("option type", JOptionPane.CANCEL_OPTION, pane.getOptionType());
         listener1.reset();
-
         pane.setOptionType(JOptionPane.OK_OPTION);
         listener1.checkPropertyFired(pane, "optionType",
-                                   new Integer(JOptionPane.CANCEL_OPTION),
-                                   new Integer(JOptionPane.OK_OPTION));
-        assertEquals("option type", JOptionPane.OK_OPTION,
-                     pane.getOptionType());
+                new Integer(JOptionPane.CANCEL_OPTION), new Integer(JOptionPane.OK_OPTION));
+        assertEquals("option type", JOptionPane.OK_OPTION, pane.getOptionType());
         listener1.reset();
-
         boolean thrown = false;
         try {
             pane.setOptionType(100);
@@ -838,53 +767,41 @@
             thrown = true;
         }
         assertTrue("exception is thrown", thrown);
-
         pane.setOptionType(JOptionPane.OK_OPTION);
         assertFalse("event's not been fired ", listener1.isChanged());
         listener1.reset();
     }
 
     public void testGetOptionType() {
-        assertEquals("option type", JOptionPane.CLOSED_OPTION,
-                     pane.getOptionType());
+        assertEquals("option type", JOptionPane.CLOSED_OPTION, pane.getOptionType());
     }
 
     public void testSetSelectionValues() {
         Object buttons2[] = new Object[] { new JButton("1"), new JButton("2") };
         Object buttons3[] = new Object[] { new JButton("1"), new JButton("2") };
-
-        PropertyChangeController listener1 =  new PropertyChangeController();
-
+        PropertyChangeController listener1 = new PropertyChangeController();
         pane.addPropertyChangeListener(listener1);
         pane.setSelectionValues(buttons2);
         listener1.checkPropertyFired(pane, "selectionValues", null, buttons2);
-        listener1.checkPropertyFired(pane, "wantsInput", Boolean.FALSE,
-                Boolean.TRUE);
+        listener1.checkPropertyFired(pane, "wantsInput", Boolean.FALSE, Boolean.TRUE);
         assertEquals("SelectionValues", buttons2, pane.getSelectionValues());
         assertTrue("SelectionValues", buttons2 == pane.getSelectionValues());
         assertTrue("wantsInput", pane.getWantsInput());
-
         pane.setWantsInput(false);
         listener1.reset();
         pane.setSelectionValues(buttons3);
-        listener1.checkPropertyFired(pane, "selectionValues", buttons2,
-                buttons3);
-        listener1.checkPropertyFired(pane, "wantsInput", Boolean.FALSE,
-                Boolean.TRUE);
+        listener1.checkPropertyFired(pane, "selectionValues", buttons2, buttons3);
+        listener1.checkPropertyFired(pane, "wantsInput", Boolean.FALSE, Boolean.TRUE);
         assertEquals("SelectionValues", buttons3, pane.getSelectionValues());
         assertTrue("SelectionValues", buttons3 == pane.getSelectionValues());
         assertTrue("wantsInput", pane.getWantsInput());
-
         pane.setWantsInput(false);
         listener1.reset();
         pane.setSelectionValues(buttons3);
-        listener1.checkLastPropertyFired(pane, "wantsInput",
-                                     Boolean.FALSE,
-                                     Boolean.TRUE);
+        listener1.checkLastPropertyFired(pane, "wantsInput", Boolean.FALSE, Boolean.TRUE);
         assertEquals("SelectionValues", buttons3, pane.getSelectionValues());
         assertTrue("SelectionValues", buttons3 == pane.getSelectionValues());
         assertTrue("wantsInput", pane.getWantsInput());
-
         pane = new JOptionPane();
         pane.setWantsInput(false);
         pane.setSelectionValues(null);
@@ -894,13 +811,10 @@
     public void testGetSelectionValues() {
         Object buttons2[] = new Object[] { new JButton("1"), new JButton("2") };
         Object buttons3[] = new Object[] { new JButton("1"), new JButton("2") };
-
         assertNull("SelectionValues", pane.getSelectionValues());
-
         pane.setSelectionValues(buttons2);
         assertEquals("SelectionValues", buttons2, pane.getSelectionValues());
         assertTrue("SelectionValues", buttons2 == pane.getSelectionValues());
-
         pane.setSelectionValues(buttons3);
         assertEquals("SelectionValues", buttons3, pane.getSelectionValues());
         assertTrue("SelectionValues", buttons3 == pane.getSelectionValues());
@@ -909,59 +823,43 @@
     public void testSetInitialSelectionValue() {
         Object str1 = "String1";
         Object str2 = "String2";
-
         pane.setWantsInput(false);
-        PropertyChangeController listener1 =  new PropertyChangeController();
-
+        PropertyChangeController listener1 = new PropertyChangeController();
         pane.addPropertyChangeListener(listener1);
         pane.setInitialSelectionValue(str1);
-        listener1.checkPropertyFired(pane, "initialSelectionValue",
-                                     null,
-                                     str1);
-
+        listener1.checkPropertyFired(pane, "initialSelectionValue", null, str1);
         pane.setWantsInput(true);
         listener1.reset();
         pane.setInitialSelectionValue(str2);
-        listener1.checkPropertyFired(pane, "initialSelectionValue",
-                                     str1,
-                                     str2);
+        listener1.checkPropertyFired(pane, "initialSelectionValue", str1, str2);
     }
 
     public void testGetInitialSelectionValue() {
         JButton button1 = new JButton("1");
         JButton button2 = new JButton("2");
-
         assertNull("InitialSelectionValue", pane.getInitialSelectionValue());
-
         pane.setWantsInput(false);
         pane.setInitialSelectionValue(button1);
         assertEquals("InitialSelectionValue", button1, pane.getInitialSelectionValue());
-
         pane.setWantsInput(true);
         pane.setInitialSelectionValue(button2);
         assertEquals("InitialSelectionValue", button2, pane.getInitialSelectionValue());
     }
 
     public void testSetInputValue() {
-        PropertyChangeController listener1 =  new PropertyChangeController();
+        PropertyChangeController listener1 = new PropertyChangeController();
         JButton button1 = new JButton("1");
         JButton button2 = new JButton("2");
-
         pane.addPropertyChangeListener(listener1);
         pane.setInputValue(button1);
-        listener1.checkPropertyFired(pane, "inputValue",
-                                     JOptionPane.UNINITIALIZED_VALUE,
-                                     button1);
+        listener1.checkPropertyFired(pane, "inputValue", JOptionPane.UNINITIALIZED_VALUE,
+                button1);
         assertEquals("input value", button1, pane.getInputValue());
         listener1.reset();
-
         pane.setInputValue(button2);
-        listener1.checkPropertyFired(pane, "inputValue",
-                                     button1,
-                                     button2);
+        listener1.checkPropertyFired(pane, "inputValue", button1, button2);
         assertEquals("input value", button2, pane.getInputValue());
         listener1.reset();
-
         pane.setInputValue(button2);
         assertFalse("event's not been fired ", listener1.isChanged());
     }
@@ -979,21 +877,16 @@
     }
 
     public void testSetWantsInput() {
-        PropertyChangeController listener1 =  new PropertyChangeController();
-
+        PropertyChangeController listener1 = new PropertyChangeController();
         pane.addPropertyChangeListener(listener1);
         pane.setWantsInput(true);
-        listener1.checkPropertyFired(pane, "wantsInput",
-                           Boolean.FALSE, Boolean.TRUE);
+        listener1.checkPropertyFired(pane, "wantsInput", Boolean.FALSE, Boolean.TRUE);
         assertTrue("wants input", pane.getWantsInput());
         listener1.reset();
-
         pane.setWantsInput(false);
-        listener1.checkPropertyFired(pane, "wantsInput",
-                           Boolean.TRUE, Boolean.FALSE);
+        listener1.checkPropertyFired(pane, "wantsInput", Boolean.TRUE, Boolean.FALSE);
         assertFalse("wants input", pane.getWantsInput());
         listener1.reset();
-
         pane.setWantsInput(false);
         assertFalse("event's not been fired ", listener1.isChanged());
         listener1.reset();
@@ -1002,5 +895,4 @@
     public void testGetWantsInput() {
         assertFalse("wants input", pane.getWantsInput());
     }
-
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JPanelTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JPanelTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JPanelTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JPanelTest.java Sat Nov 25 16:04:10 2006
@@ -24,14 +24,11 @@
 import java.awt.GridLayout;
 import java.awt.LayoutManager;
 import java.io.IOException;
-
 import javax.accessibility.AccessibleRole;
 import javax.swing.plaf.PanelUI;
 import javax.swing.plaf.basic.BasicPanelUI;
 
-
 public class JPanelTest extends SwingTestCase {
-
     /**
      * @param arg0
      */
@@ -48,6 +45,7 @@
     /*
      * @see TestCase#setUp()
      */
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         panel = new JPanel();
@@ -56,6 +54,7 @@
     /*
      * @see TestCase#tearDown()
      */
+    @Override
     protected void tearDown() throws Exception {
         super.tearDown();
     }
@@ -78,7 +77,6 @@
         assertTrue(panel.isOpaque());
         assertSame(layout1, panel.getLayout());
         assertTrue(panel.isDoubleBuffered());
-
         final LayoutManager layout2 = new FlowLayout();
         panel = new JPanel(layout2, false);
         assertTrue(panel.isOpaque());
@@ -95,7 +93,6 @@
         assertTrue(panel.isOpaque());
         assertSame(layout1, panel.getLayout());
         assertTrue(panel.isDoubleBuffered());
-
         final LayoutManager layout2 = new FlowLayout();
         panel = new JPanel(layout2);
         assertTrue(panel.isOpaque());
@@ -111,7 +108,6 @@
         assertTrue(panel.isOpaque());
         assertTrue(panel.getLayout().getClass() == FlowLayout.class);
         assertTrue(panel.isDoubleBuffered());
-
         panel = new JPanel(false);
         assertTrue(panel.isOpaque());
         assertTrue(panel.getLayout().getClass() == FlowLayout.class);
@@ -147,11 +143,12 @@
      * Class under test for AccessibleContext getAccessibleContext()
      */
     public void testGetAccessibleContext() {
-        boolean assertedValue = (panel.getAccessibleContext() != null &&
-                panel.getAccessibleContext().getClass().getName().equals("javax.swing.JPanel$AccessibleJPanel"));
-
+        boolean assertedValue = (panel.getAccessibleContext() != null && panel
+                .getAccessibleContext().getClass().getName().equals(
+                        "javax.swing.JPanel$AccessibleJPanel"));
         assertTrue(assertedValue);
-        assertTrue(panel.getAccessibleContext().getAccessibleRole().equals(AccessibleRole.PANEL));
+        assertTrue(panel.getAccessibleContext().getAccessibleRole()
+                .equals(AccessibleRole.PANEL));
     }
 
     /*
@@ -159,10 +156,13 @@
      */
     public void testParamString() {
         class TestingPanel extends JPanel {
-            public String getParamString(){ return paramString(); }
+            private static final long serialVersionUID = 1L;
+
+            public String getParamString() {
+                return paramString();
+            }
         }
         TestingPanel testingPanel = new TestingPanel();
-
         assertTrue(testingPanel.getParamString() != null);
         assertTrue(testingPanel.getParamString() != "");
     }
@@ -176,37 +176,37 @@
 
     public void testWriteObject() throws IOException {
         /*
-        JPanel button1 = new JPanel();
-        JPanel button2 = new JPanel();
-        FileOutputStream fo = new FileOutputStream("tmp");
-        ObjectOutputStream so = new ObjectOutputStream(fo);
-        so.writeObject(button1);
-        so.flush();
-        fo = new FileOutputStream("tmp");
-        so = new ObjectOutputStream(fo);
-        so.writeObject(button1);
-        so.flush();
-        */
+         JPanel button1 = new JPanel();
+         JPanel button2 = new JPanel();
+         FileOutputStream fo = new FileOutputStream("tmp");
+         ObjectOutputStream so = new ObjectOutputStream(fo);
+         so.writeObject(button1);
+         so.flush();
+         fo = new FileOutputStream("tmp");
+         so = new ObjectOutputStream(fo);
+         so.writeObject(button1);
+         so.flush();
+         */
     }
 
     public void testReadObject() throws IOException, ClassNotFoundException {
         /*
-        JPanel button1 = new JPanel();
-        JPanel button2 = new JPanel();
-        FileOutputStream fo = new FileOutputStream("tmp");
-        ObjectOutputStream so = new ObjectOutputStream(fo);
-        so.writeObject(button1);
-        so.flush();
-        FileInputStream fi = new FileInputStream("tmp");
-        ObjectInputStream si = new ObjectInputStream(fi);
-        JPanel ressurectedButton = (JPanel)si.readObject();
-        fo = new FileOutputStream("tmp");
-        so = new ObjectOutputStream(fo);
-        so.writeObject(button2);
-        so.flush();
-        fi = new FileInputStream("tmp");
-        si = new ObjectInputStream(fi);
-        ressurectedButton = (JPanel)si.readObject();
-        */
+         JPanel button1 = new JPanel();
+         JPanel button2 = new JPanel();
+         FileOutputStream fo = new FileOutputStream("tmp");
+         ObjectOutputStream so = new ObjectOutputStream(fo);
+         so.writeObject(button1);
+         so.flush();
+         FileInputStream fi = new FileInputStream("tmp");
+         ObjectInputStream si = new ObjectInputStream(fi);
+         JPanel ressurectedButton = (JPanel)si.readObject();
+         fo = new FileOutputStream("tmp");
+         so = new ObjectOutputStream(fo);
+         so.writeObject(button2);
+         so.flush();
+         fi = new FileInputStream("tmp");
+         si = new ObjectInputStream(fi);
+         ressurectedButton = (JPanel)si.readObject();
+         */
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JPasswordFieldTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JPasswordFieldTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JPasswordFieldTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JPasswordFieldTest.java Sat Nov 25 16:04:10 2006
@@ -20,14 +20,6 @@
  */
 package javax.swing;
 
-import java.awt.Toolkit;
-import java.awt.datatransfer.Clipboard;
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.StringSelection;
-import java.awt.datatransfer.Transferable;
-import java.awt.datatransfer.UnsupportedFlavorException;
-import java.io.IOException;
-
 import javax.accessibility.AccessibleContext;
 import javax.accessibility.AccessibleRole;
 import javax.swing.text.BadLocationException;
@@ -36,54 +28,36 @@
 
 public class JPasswordFieldTest extends SwingTestCase {
     JPasswordField pf;
+
     boolean bWasException;
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         pf = new JPasswordField();
         bWasException = false;
     }
 
+    @Override
     protected void tearDown() throws Exception {
         super.tearDown();
     }
 
-    private void setContentInSystemClipboard(final String content) {
-        StringSelection selection = new StringSelection(content);
-        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
-        clipboard.setContents(selection, null);
-    }
-
-    private Object getSystemClipboardContent() {
-        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
-        Transferable transferable = clipboard.getContents(null);
-        DataFlavor flavor = transferable.getTransferDataFlavors()[0];
-        Object data = null;
-        try {
-           data = transferable.getTransferData(flavor);
-        } catch (UnsupportedFlavorException e) {
-            assertTrue("Unexpected exception: ", false);
-        } catch (IOException e) {
-            assertTrue("Unexpected exception: ", false);
-        }
-        return data;
-    }
-
     public void testCopy() {
         // TODO: uncomment when System clipboard is properly supported
-//        pf.setText("abcdef");
-//        setContentInSystemClipboard("1234");
-//        pf.copy();
-//        assertEquals("1234", getSystemClipboardContent());
+        //        pf.setText("abcdef");
+        //        setContentInSystemClipboard("1234");
+        //        pf.copy();
+        //        assertEquals("1234", getSystemClipboardContent());
     }
 
     public void testCut() {
         // TODO: uncomment when System clipboard is properly supported
-//        pf.setText("abcdef");
-//        setContentInSystemClipboard("1234");
-//        pf.cut();
-//        assertEquals("1234", getSystemClipboardContent());
-//        assertEquals("abcdef", pf.getText());
+        //        pf.setText("abcdef");
+        //        setContentInSystemClipboard("1234");
+        //        pf.cut();
+        //        assertEquals("1234", getSystemClipboardContent());
+        //        assertEquals("abcdef", pf.getText());
     }
 
     public void testJPasswordField() {
@@ -97,7 +71,6 @@
         assertTrue(pf.getDocument() instanceof PlainDocument);
         assertEquals(0, pf.getColumns());
         assertEquals("", pf.getText());
-
         pf = new JPasswordField("abc");
         assertTrue(pf.getDocument() instanceof PlainDocument);
         assertEquals(0, pf.getColumns());
@@ -171,25 +144,23 @@
     public void testGetTextintint() {
         pf.setText("abcd");
         try {
-           assertEquals("", pf.getText(1, 0));
-           assertEquals("c", pf.getText(2, 1));
+            assertEquals("", pf.getText(1, 0));
+            assertEquals("c", pf.getText(2, 1));
         } catch (BadLocationException e) {
             assertTrue("Unexpected exception: ", false);
         }
-
         try {
-           pf.getText(100, 3);
+            pf.getText(100, 3);
         } catch (BadLocationException e) {
             bWasException = true;
         }
         checkException();
-
         try {
             pf.getText(1, -63);
-         } catch (BadLocationException e) {
-             bWasException = true;
-         }
-         checkException();
+        } catch (BadLocationException e) {
+            bWasException = true;
+        }
+        checkException();
     }
 
     public void testGetUIClassID() {



Mime
View raw message