harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r479418 [41/43] - in /harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common: javax/swing/ javax/swing/border/ javax/swing/colorchooser/ javax/swing/event/ javax/swing/filechooser/ javax/swing/plaf/ javax/swing/plaf/basic/ j...
Date Sun, 26 Nov 2006 20:15:55 GMT
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/tree/DefaultTreeCellEditorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/tree/DefaultTreeCellEditorTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/tree/DefaultTreeCellEditorTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/tree/DefaultTreeCellEditorTest.java Sun Nov 26 12:15:43 2006
@@ -24,10 +24,10 @@
 import java.awt.Dimension;
 import java.awt.Font;
 import java.awt.Rectangle;
+import java.awt.event.InputEvent;
 import java.awt.event.KeyEvent;
 import java.awt.event.MouseEvent;
 import java.util.EventObject;
-
 import javax.swing.BasicSwingTestCase;
 import javax.swing.BorderFactory;
 import javax.swing.DefaultCellEditor;
@@ -43,19 +43,23 @@
 
 public class DefaultTreeCellEditorTest extends BasicSwingTestCase {
     private DefaultTreeCellEditor editor;
+
     private DefaultTreeCellRenderer renderer;
+
     private JTree tree;
 
     public DefaultTreeCellEditorTest(final String name) {
         super(name);
     }
 
+    @Override
     protected void setUp() throws Exception {
         tree = new JTree();
         renderer = new DefaultTreeCellRenderer();
         editor = new DefaultTreeCellEditor(tree, renderer);
     }
 
+    @Override
     protected void tearDown() throws Exception {
         editor = null;
         tree = null;
@@ -65,9 +69,8 @@
     public void testDefaultTextField() throws Exception {
         editor.getTreeCellEditorComponent(tree, "any", false, true, false, 0);
         assertTrue(editor.editingComponent instanceof DefaultTreeCellEditor.DefaultTextField);
-        DefaultTreeCellEditor.DefaultTextField defaultTextField = (DefaultTreeCellEditor.DefaultTextField)editor.editingComponent;
+        DefaultTreeCellEditor.DefaultTextField defaultTextField = (DefaultTreeCellEditor.DefaultTextField) editor.editingComponent;
         assertEquals(UIManager.getBorder("Tree.editorBorder"), defaultTextField.border);
-
         Border b = BorderFactory.createBevelBorder(0);
         defaultTextField = editor.new DefaultTextField(b);
         assertSame(b, defaultTextField.border);
@@ -77,10 +80,8 @@
         Border b = BorderFactory.createBevelBorder(0);
         DefaultTreeCellEditor.DefaultTextField defaultTextField = editor.new DefaultTextField(b);
         assertSame(b, defaultTextField.getBorder());
-
         propertyChangeController = new PropertyChangeController();
         defaultTextField.addPropertyChangeListener(propertyChangeController);
-
         b = BorderFactory.createEmptyBorder();
         defaultTextField.setBorder(b);
         assertSame(b, defaultTextField.getBorder());
@@ -88,33 +89,31 @@
     }
 
     public void testDefaultTextField_getFont() throws Exception {
-        DefaultTreeCellEditor.DefaultTextField defaultTextField = editor.new DefaultTextField(BorderFactory.createBevelBorder(0));
+        DefaultTreeCellEditor.DefaultTextField defaultTextField = editor.new DefaultTextField(
+                BorderFactory.createBevelBorder(0));
         assertEquals(UIManager.getFont("TextField.font"), defaultTextField.getFont());
-
         Font f = new Font("font", 0, 30);
         defaultTextField.setFont(f);
         assertEquals(f, defaultTextField.getFont());
-
         defaultTextField.setFont(null);
         assertNull(defaultTextField.getFont());
-
         editor.setFont(f);
         assertNull(defaultTextField.getFont());
-
         editor.renderer.setFont(f);
         assertNull(defaultTextField.getFont());
-
         editor.tree.setFont(f);
         assertNull(defaultTextField.getFont());
     }
 
     public void testDefaultTextField_getPreferredSize() throws Exception {
-        DefaultTreeCellEditor.DefaultTextField defaultTextField = editor.new DefaultTextField(BorderFactory.createBevelBorder(0));
+        DefaultTreeCellEditor.DefaultTextField defaultTextField = editor.new DefaultTextField(
+                BorderFactory.createBevelBorder(0));
         defaultTextField.setText("value");
-        assertEquals(new Dimension(new JTextField("value").getPreferredSize().width, 0), defaultTextField.getPreferredSize());
-
+        assertEquals(new Dimension(new JTextField("value").getPreferredSize().width, 0),
+                defaultTextField.getPreferredSize());
         editor.renderer.setPreferredSize(new Dimension(100, 200));
-        assertEquals(new Dimension(new JTextField("value").getPreferredSize().width, 200), defaultTextField.getPreferredSize());
+        assertEquals(new Dimension(new JTextField("value").getPreferredSize().width, 200),
+                defaultTextField.getPreferredSize());
     }
 
     public void testEditorContainer() throws Exception {
@@ -126,38 +125,36 @@
     public void testEditorContainer_getPreferredSize() throws Exception {
         DefaultTreeCellEditor.EditorContainer container = editor.new EditorContainer();
         assertEquals(new Dimension(), container.getPreferredSize());
-
         editor.editingComponent = new JTextField("a");
-        assertEquals(new Dimension(100, editor.editingComponent.getPreferredSize().height), container.getPreferredSize());
-
+        assertEquals(new Dimension(100, editor.editingComponent.getPreferredSize().height),
+                container.getPreferredSize());
         editor.offset = 1000;
-        assertEquals(new Dimension(1000 + editor.editingComponent.getPreferredSize().width + 5, editor.editingComponent.getPreferredSize().height), container.getPreferredSize());
-
+        assertEquals(new Dimension(1000 + editor.editingComponent.getPreferredSize().width + 5,
+                editor.editingComponent.getPreferredSize().height), container
+                .getPreferredSize());
         editor.renderer.setPreferredSize(new Dimension(2000, 10));
-        assertEquals(new Dimension(1000 + editor.editingComponent.getPreferredSize().width + 5, editor.editingComponent.getPreferredSize().height), container.getPreferredSize());
-
+        assertEquals(new Dimension(1000 + editor.editingComponent.getPreferredSize().width + 5,
+                editor.editingComponent.getPreferredSize().height), container
+                .getPreferredSize());
         editor.renderer.setPreferredSize(new Dimension(2000, 30));
-        assertEquals(new Dimension(1000 + editor.editingComponent.getPreferredSize().width + 5, 30), container.getPreferredSize());
+        assertEquals(new Dimension(1000 + editor.editingComponent.getPreferredSize().width + 5,
+                30), container.getPreferredSize());
     }
 
     public void testEditorContainer_doLayout() throws Exception {
         DefaultTreeCellEditor.EditorContainer container = editor.new EditorContainer();
         editor.editingComponent = new JTextField("any");
         assertEquals(new Rectangle(0, 0, 0, 0), editor.editingComponent.getBounds());
-
         container.doLayout();
         assertEquals(new Rectangle(0, 0, 0, 0), editor.editingComponent.getBounds());
-
         editor.offset = 10;
         container.doLayout();
         assertEquals(new Rectangle(10, 0, -10, 0), editor.editingComponent.getBounds());
-
         container.setBounds(0, 0, 100, 100);
         container.doLayout();
         assertEquals(new Rectangle(10, 0, 90, 100), editor.editingComponent.getBounds());
     }
 
-
     public void testDefaultTreeCellEditor() throws Exception {
         assertNull(editor.borderSelectionColor);
         assertFalse(editor.canEdit);
@@ -172,23 +169,19 @@
         assertSame(renderer, editor.renderer);
         assertNull(editor.timer);
         assertSame(tree, editor.tree);
-        assertEquals(1, ((DefaultCellEditor)editor.realEditor).getClickCountToStart());
-
-
+        assertEquals(1, ((DefaultCellEditor) editor.realEditor).getClickCountToStart());
         DefaultCellEditor realEditor = new DefaultCellEditor(new JTextField());
         realEditor.setClickCountToStart(4);
         editor = new DefaultTreeCellEditor(tree, renderer, realEditor);
         assertSame(realEditor, editor.realEditor);
-        assertEquals(4, ((DefaultCellEditor)editor.realEditor).getClickCountToStart());
+        assertEquals(4, ((DefaultCellEditor) editor.realEditor).getClickCountToStart());
     }
 
     public void testGetSetBorderSelectionColor() throws Exception {
         assertNull(editor.getBorderSelectionColor());
-
         Color c = Color.RED;
         editor.setBorderSelectionColor(c);
         assertSame(c, editor.getBorderSelectionColor());
-
         c = new ColorUIResource(Color.BLUE);
         editor.setBorderSelectionColor(c);
         assertSame(c, editor.getBorderSelectionColor());
@@ -199,50 +192,49 @@
         Font font = new Font("font", 0, 20);
         renderer.setFont(font);
         assertNull(editor.getFont());
-        assertSame(font, editor.getTreeCellEditorComponent(tree, "value", false, false, false, 0).getFont());
-
+        assertSame(font, editor.getTreeCellEditorComponent(tree, "value", false, false, false,
+                0).getFont());
         font = new Font("font", 0, 50);
         editor.setFont(font);
         assertSame(font, editor.getFont());
-        assertSame(font, editor.getTreeCellEditorComponent(tree, "value", false, false, false, 0).getFont());
+        assertSame(font, editor.getTreeCellEditorComponent(tree, "value", false, false, false,
+                0).getFont());
     }
 
     public void testGetTreeCellEditorComponent() throws Exception {
         Font font = new Font("font", 0, 30);
         tree.setFont(font);
-
         assertNull(editor.editingComponent);
-        assertSame(editor.editingContainer, editor.getTreeCellEditorComponent(tree, "value", false, false, false, 0));
+        assertSame(editor.editingContainer, editor.getTreeCellEditorComponent(tree, "value",
+                false, false, false, 0));
         assertEquals(1, editor.editingContainer.getComponentCount());
         assertSame(font, editor.editingContainer.getFont());
         assertSame(font, editor.editingComponent.getFont());
-        assertSame(editor.realEditor.getTreeCellEditorComponent(tree, "value", false, false, false, 0), editor.editingContainer.getComponent(0));
+        assertSame(editor.realEditor.getTreeCellEditorComponent(tree, "value", false, false,
+                false, 0), editor.editingContainer.getComponent(0));
         assertSame(editor.editingContainer.getComponent(0), editor.editingComponent);
-
         assertTrue(editor.editingComponent instanceof DefaultTreeCellEditor.DefaultTextField);
-        DefaultTreeCellEditor.DefaultTextField textField = (DefaultTextField)editor.editingComponent;
+        DefaultTreeCellEditor.DefaultTextField textField = (DefaultTextField) editor.editingComponent;
         assertEquals("value", textField.getText());
         assertEquals(tree.getFont(), textField.getFont());
     }
 
     public void testGetCellEditorValue() throws Exception {
         assertEquals("", editor.getCellEditorValue());
-
         editor.editingComponent = new JTextField("any");
         assertEquals("", editor.getCellEditorValue());
-
         editor.realEditor.getTreeCellEditorComponent(tree, "value", false, false, false, 0);
         assertEquals("value", editor.getCellEditorValue());
-        assertEquals("any", ((JTextField)editor.editingComponent).getText());
-
+        assertEquals("any", ((JTextField) editor.editingComponent).getText());
         editor.getTreeCellEditorComponent(tree, "value2", false, false, false, 0);
         assertEquals("value2", editor.getCellEditorValue());
-        assertEquals("value2", ((JTextField)editor.editingComponent).getText());
+        assertEquals("value2", ((JTextField) editor.editingComponent).getText());
     }
 
     public void testIsCellEditable() throws Exception {
         final Marker m = new Marker();
         editor = new DefaultTreeCellEditor(tree, renderer) {
+            @Override
             protected void prepareForEditing() {
                 m.setOccurred();
             }
@@ -254,6 +246,7 @@
     public void testShouldSelectCell() throws Exception {
         final Marker m = new Marker();
         editor = new DefaultTreeCellEditor(tree, renderer) {
+            @Override
             public boolean shouldSelectCell(final EventObject e) {
                 m.setOccurred();
                 m.setAuxiliary(e);
@@ -270,7 +263,6 @@
         editor.getTreeCellEditorComponent(tree, "value", false, false, false, 0);
         assertNotNull(editor.editingComponent);
         assertEquals(1, editor.editingContainer.getComponentCount());
-
         assertTrue(editor.stopCellEditing());
         assertNull(editor.editingComponent);
         assertEquals(0, editor.editingContainer.getComponentCount());
@@ -280,7 +272,6 @@
         editor.getTreeCellEditorComponent(tree, "value", false, false, false, 0);
         assertNotNull(editor.editingComponent);
         assertEquals(1, editor.editingContainer.getComponentCount());
-
         editor.cancelCellEditing();
         assertNull(editor.editingComponent);
         assertEquals(0, editor.editingContainer.getComponentCount());
@@ -288,24 +279,23 @@
 
     public void testAddRemoveGetCellEditorListener() throws Exception {
         assertEquals(0, editor.getCellEditorListeners().length);
-        assertEquals(0, ((DefaultCellEditor)editor.realEditor).getCellEditorListeners().length);
+        assertEquals(0, ((DefaultCellEditor) editor.realEditor).getCellEditorListeners().length);
         CellEditorListener l = new CellEditorListener() {
             public void editingStopped(ChangeEvent e) {
             }
+
             public void editingCanceled(ChangeEvent e) {
             }
         };
         editor.addCellEditorListener(l);
         assertEquals(1, editor.getCellEditorListeners().length);
-        assertEquals(1, ((DefaultCellEditor)editor.realEditor).getCellEditorListeners().length);
-
+        assertEquals(1, ((DefaultCellEditor) editor.realEditor).getCellEditorListeners().length);
         editor.removeCellEditorListener(l);
-        assertEquals(0, ((DefaultCellEditor)editor.realEditor).getCellEditorListeners().length);
+        assertEquals(0, ((DefaultCellEditor) editor.realEditor).getCellEditorListeners().length);
     }
 
     public void testValueChanged() throws Exception {
         TreePath treePath = new TreePath("root");
-
         editor.valueChanged(new TreeSelectionEvent(tree, treePath, true, null, treePath));
         if (isHarmony()) {
             assertEquals(treePath, editor.lastPath);
@@ -328,7 +318,6 @@
     public void testSetTree() throws Exception {
         JTree anotherTree = new JTree();
         assertEquals(0, anotherTree.getTreeSelectionListeners().length);
-
         editor.setTree(anotherTree);
         assertEquals(1, anotherTree.getTreeSelectionListeners().length);
         assertSame(anotherTree, editor.tree);
@@ -336,8 +325,12 @@
 
     public void testShouldStartEditingTimer() throws Exception {
         assertFalse(editor.shouldStartEditingTimer(null));
-        assertTrue(editor.shouldStartEditingTimer(new MouseEvent(tree, MouseEvent.MOUSE_PRESSED, 0, MouseEvent.BUTTON1_DOWN_MASK, 1, 1, 1, false, MouseEvent.BUTTON1)));
-        assertFalse(editor.shouldStartEditingTimer(new MouseEvent(tree, MouseEvent.MOUSE_PRESSED, 0, MouseEvent.BUTTON1_DOWN_MASK, 1, 1, 2, false, MouseEvent.BUTTON1)));
+        assertTrue(editor.shouldStartEditingTimer(new MouseEvent(tree,
+                MouseEvent.MOUSE_PRESSED, 0, InputEvent.BUTTON1_DOWN_MASK, 1, 1, 1, false,
+                MouseEvent.BUTTON1)));
+        assertFalse(editor.shouldStartEditingTimer(new MouseEvent(tree,
+                MouseEvent.MOUSE_PRESSED, 0, InputEvent.BUTTON1_DOWN_MASK, 1, 1, 2, false,
+                MouseEvent.BUTTON1)));
     }
 
     public void testStartEditingTimer() throws Exception {
@@ -347,13 +340,19 @@
         assertEquals(1200, editor.timer.getDelay());
     }
 
+    @SuppressWarnings("deprecation")
     public void testCanEditimmediately() throws Exception {
         assertTrue(editor.canEditImmediately(null));
-        assertTrue(editor.canEditImmediately(new MouseEvent(tree, MouseEvent.MOUSE_PRESSED, 0, 0, 1, 1, 3, false, MouseEvent.BUTTON1)));
-        assertTrue(editor.canEditImmediately(new MouseEvent(tree, MouseEvent.MOUSE_PRESSED, 0, 0, 1, 1, 4, false, MouseEvent.BUTTON1)));
-        assertFalse(editor.canEditImmediately(new MouseEvent(tree, MouseEvent.MOUSE_PRESSED, 0, 0, 1, 1, 3, false, MouseEvent.BUTTON2)));
-        assertFalse(editor.canEditImmediately(new MouseEvent(tree, MouseEvent.MOUSE_PRESSED, 0, 0, 1, 1, 2, false, MouseEvent.BUTTON1)));
-        assertFalse(editor.canEditImmediately(new KeyEvent(tree, KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_1)));
+        assertTrue(editor.canEditImmediately(new MouseEvent(tree, MouseEvent.MOUSE_PRESSED, 0,
+                0, 1, 1, 3, false, MouseEvent.BUTTON1)));
+        assertTrue(editor.canEditImmediately(new MouseEvent(tree, MouseEvent.MOUSE_PRESSED, 0,
+                0, 1, 1, 4, false, MouseEvent.BUTTON1)));
+        assertFalse(editor.canEditImmediately(new MouseEvent(tree, MouseEvent.MOUSE_PRESSED, 0,
+                0, 1, 1, 3, false, MouseEvent.BUTTON2)));
+        assertFalse(editor.canEditImmediately(new MouseEvent(tree, MouseEvent.MOUSE_PRESSED, 0,
+                0, 1, 1, 2, false, MouseEvent.BUTTON1)));
+        assertFalse(editor.canEditImmediately(new KeyEvent(tree, KeyEvent.KEY_PRESSED, 0, 0,
+                KeyEvent.VK_1)));
     }
 
     public void testInHitRegion() throws Exception {
@@ -364,7 +363,6 @@
         } else {
             assertTrue(editor.inHitRegion(1000, 1000));
         }
-
         editor.offset = 30;
         assertFalse(editor.inHitRegion(30, 1));
         assertTrue(editor.inHitRegion(31, 1));
@@ -372,10 +370,8 @@
 
     public void testDetermineOffset() throws Exception {
         assertEquals(0, editor.offset);
-
         editor.determineOffset(tree, "value", false, false, false, 0);
         assertEquals(20, editor.offset);
-
         editor.offset = 10;
         editor.determineOffset(tree, "value", false, false, false, 0);
         assertEquals(20, editor.offset);
@@ -385,7 +381,6 @@
         assertEquals(0, editor.editingContainer.getComponentCount());
         editor.prepareForEditing();
         assertEquals(0, editor.editingContainer.getComponentCount());
-
         editor.editingComponent = new JTextField("any");
         editor.prepareForEditing();
         assertEquals(1, editor.editingContainer.getComponentCount());
@@ -399,7 +394,9 @@
     public void testCreateTreeCellEditor() throws Exception {
         assertNotSame(editor.createTreeCellEditor(), editor.createTreeCellEditor());
         assertTrue(editor.createTreeCellEditor() instanceof DefaultCellEditor);
-        assertTrue(editor.createTreeCellEditor().getTreeCellEditorComponent(tree, "any", false, true, false, 0) instanceof DefaultTreeCellEditor.DefaultTextField);
-        assertEquals(1, ((DefaultCellEditor)editor.createTreeCellEditor()).getClickCountToStart());
+        assertTrue(editor.createTreeCellEditor().getTreeCellEditorComponent(tree, "any", false,
+                true, false, 0) instanceof DefaultTreeCellEditor.DefaultTextField);
+        assertEquals(1, ((DefaultCellEditor) editor.createTreeCellEditor())
+                .getClickCountToStart());
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/tree/DefaultTreeCellRendererTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/tree/DefaultTreeCellRendererTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/tree/DefaultTreeCellRendererTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/tree/DefaultTreeCellRendererTest.java Sun Nov 26 12:15:43 2006
@@ -25,7 +25,6 @@
 import java.awt.Dimension;
 import java.awt.Font;
 import java.awt.Graphics;
-
 import javax.swing.BasicSwingTestCase;
 import javax.swing.Icon;
 import javax.swing.JLabel;
@@ -42,10 +41,12 @@
         super(name);
     }
 
+    @Override
     protected void setUp() throws Exception {
         renderer = new DefaultTreeCellRenderer();
     }
 
+    @Override
     protected void tearDown() throws Exception {
         renderer = null;
     }
@@ -58,10 +59,11 @@
         assertNotNull(renderer.openIcon);
         assertSame(UIManager.getColor("Tree.selectionForeground"), renderer.textSelectionColor);
         assertSame(UIManager.getColor("Tree.foreground"), renderer.textNonSelectionColor);
-        assertSame(UIManager.getColor("Tree.selectionBackground"), renderer.backgroundSelectionColor);
+        assertSame(UIManager.getColor("Tree.selectionBackground"),
+                renderer.backgroundSelectionColor);
         assertSame(UIManager.getColor("Tree.background"), renderer.backgroundNonSelectionColor);
-        assertSame(UIManager.getColor("Tree.selectionBorderColor"), renderer.borderSelectionColor);
-
+        assertSame(UIManager.getColor("Tree.selectionBorderColor"),
+                renderer.borderSelectionColor);
         assertEquals(SwingConstants.LEFT, renderer.getHorizontalAlignment());
         assertEquals(SwingConstants.TRAILING, renderer.getHorizontalTextPosition());
         assertEquals(SwingConstants.CENTER, renderer.getVerticalAlignment());
@@ -88,43 +90,36 @@
 
     public void testGetSetOpenIcon() throws Exception {
         assertSame(renderer.getDefaultOpenIcon(), renderer.getOpenIcon());
-
         Icon icon = createTestIcon();
         renderer.setOpenIcon(icon);
         assertSame(icon, renderer.openIcon);
         assertSame(icon, renderer.getOpenIcon());
-
         renderer.setOpenIcon(null);
         assertNull(renderer.getOpenIcon());
     }
 
     public void testGetSetClosedIcon() throws Exception {
         assertSame(renderer.getDefaultClosedIcon(), renderer.getClosedIcon());
-
         Icon icon = createTestIcon();
         renderer.setClosedIcon(icon);
         assertSame(icon, renderer.closedIcon);
         assertSame(icon, renderer.getClosedIcon());
-
         renderer.setClosedIcon(null);
         assertNull(renderer.getClosedIcon());
     }
 
     public void testGetSetLeafIcon() throws Exception {
         assertSame(renderer.getDefaultLeafIcon(), renderer.getLeafIcon());
-
         Icon icon = createTestIcon();
         renderer.setLeafIcon(icon);
         assertSame(icon, renderer.leafIcon);
         assertSame(icon, renderer.getLeafIcon());
-
         renderer.setLeafIcon(null);
         assertNull(renderer.getLeafIcon());
     }
 
     public void testGetSetTextSelectionColor() throws Exception {
         assertSame(renderer.textSelectionColor, renderer.getTextSelectionColor());
-
         renderer.setTextSelectionColor(Color.BLUE);
         assertSame(Color.BLUE, renderer.getTextSelectionColor());
         assertSame(renderer.textSelectionColor, renderer.getTextSelectionColor());
@@ -132,7 +127,6 @@
 
     public void testGetSetTextNonSelectionColor() throws Exception {
         assertSame(renderer.textNonSelectionColor, renderer.getTextNonSelectionColor());
-
         renderer.setTextNonSelectionColor(Color.MAGENTA);
         assertSame(Color.MAGENTA, renderer.getTextNonSelectionColor());
         assertSame(renderer.textNonSelectionColor, renderer.getTextNonSelectionColor());
@@ -140,23 +134,22 @@
 
     public void testGetSetBackgroundSelectionColor() throws Exception {
         assertSame(renderer.backgroundSelectionColor, renderer.getBackgroundSelectionColor());
-
         renderer.setBackgroundSelectionColor(Color.GREEN);
         assertSame(Color.GREEN, renderer.getBackgroundSelectionColor());
         assertSame(renderer.backgroundSelectionColor, renderer.getBackgroundSelectionColor());
     }
 
     public void testGetSetBackgroundNonSelectionColor() throws Exception {
-        assertSame(renderer.backgroundNonSelectionColor, renderer.getBackgroundNonSelectionColor());
-
+        assertSame(renderer.backgroundNonSelectionColor, renderer
+                .getBackgroundNonSelectionColor());
         renderer.setBackgroundNonSelectionColor(Color.GRAY);
         assertSame(Color.GRAY, renderer.getBackgroundNonSelectionColor());
-        assertSame(renderer.backgroundNonSelectionColor, renderer.getBackgroundNonSelectionColor());
+        assertSame(renderer.backgroundNonSelectionColor, renderer
+                .getBackgroundNonSelectionColor());
     }
 
     public void testGetSetBorderSelectionColor() throws Exception {
         assertSame(renderer.borderSelectionColor, renderer.getBorderSelectionColor());
-
         renderer.setBorderSelectionColor(Color.YELLOW);
         assertSame(Color.YELLOW, renderer.getBorderSelectionColor());
         assertSame(renderer.borderSelectionColor, renderer.getBorderSelectionColor());
@@ -164,13 +157,10 @@
 
     public void testGetSetFont() throws Exception {
         assertNull(renderer.getFont());
-
         renderer.setFont(null);
         assertNull(renderer.getFont());
-
         renderer.setFont(new FontUIResource("font", 10, 0));
         assertNull(renderer.getFont());
-
         Font userFont = new Font("font", 20, 1);
         renderer.setFont(userFont);
         assertSame(userFont, renderer.getFont());
@@ -178,13 +168,10 @@
 
     public void testSetBackground() throws Exception {
         assertNull(renderer.getBackground());
-
         renderer.setBackground(null);
         assertNull(renderer.getBackground());
-
         renderer.setBackground(new ColorUIResource(Color.BLUE));
         assertNull(renderer.getBackground());
-
         renderer.setBackground(Color.RED);
         assertSame(Color.RED, renderer.getBackground());
     }
@@ -193,8 +180,8 @@
         JTree tree = new JTree();
         tree.setFont(new Font("font", 20, 1));
         tree.setBackground(Color.MAGENTA);
-
-        assertSame(renderer, renderer.getTreeCellRendererComponent(tree, "value", false, false, false, 0, false));
+        assertSame(renderer, renderer.getTreeCellRendererComponent(tree, "value", false, false,
+                false, 0, false));
         assertFalse(renderer.isOpaque());
         assertNull(renderer.getBackground());
         assertSame(renderer.textNonSelectionColor, renderer.getForeground());
@@ -202,7 +189,6 @@
         assertSame(tree.getFont(), renderer.getFont());
         assertSame(renderer.getDefaultClosedIcon(), renderer.getIcon());
         assertNull(renderer.getBorder());
-
         renderer.getTreeCellRendererComponent(tree, "value", true, true, false, 0, false);
         assertFalse(renderer.isOpaque());
         assertNull(renderer.getBackground());
@@ -211,7 +197,6 @@
         assertSame(tree.getFont(), renderer.getFont());
         assertSame(renderer.getDefaultOpenIcon(), renderer.getIcon());
         assertNull(renderer.getBorder());
-
         renderer.getTreeCellRendererComponent(tree, "value", true, true, true, 0, true);
         assertFalse(renderer.isOpaque());
         assertNull(renderer.getBackground());
@@ -220,7 +205,6 @@
         assertSame(tree.getFont(), renderer.getFont());
         assertSame(renderer.getDefaultLeafIcon(), renderer.getIcon());
         assertNull(renderer.getBorder());
-
         renderer.setBackgroundSelectionColor(Color.RED);
         renderer.getTreeCellRendererComponent(tree, "value", true, true, true, 0, true);
         if (isHarmony()) {
@@ -240,15 +224,13 @@
         label.setFont(renderer.getFont());
         Dimension baseDimenstion = label.getPreferredSize();
         if (isHarmony()) {
-            assertEquals(new Dimension(baseDimenstion.width + 2, baseDimenstion.height), renderer.getPreferredSize());
+            assertEquals(new Dimension(baseDimenstion.width + 2, baseDimenstion.height),
+                    renderer.getPreferredSize());
         } else {
-            assertEquals(new Dimension(baseDimenstion.width + 3, baseDimenstion.height), renderer.getPreferredSize());
+            assertEquals(new Dimension(baseDimenstion.width + 3, baseDimenstion.height),
+                    renderer.getPreferredSize());
         }
     }
-
-
-
-
 
     private Icon createTestIcon() {
         return new Icon() {

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/tree/DefaultTreeModelTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/tree/DefaultTreeModelTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/tree/DefaultTreeModelTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/tree/DefaultTreeModelTest.java Sun Nov 26 12:15:43 2006
@@ -15,29 +15,31 @@
  *  limitations under the License.
  */
 /**
-* @author Alexander T. Simbirtsev
-* @version $Revision$
-*/
+ * @author Alexander T. Simbirtsev
+ * @version $Revision$
+ */
 package javax.swing.tree;
 
 import java.beans.PropertyChangeListener;
 import java.util.Arrays;
 import java.util.EventListener;
-
 import javax.swing.SwingTestCase;
 import javax.swing.event.TreeModelEvent;
 import javax.swing.event.TreeModelListener;
 import javax.swing.event.SwingPropertyChangeSupportTest.FindableListener;
 
 public class DefaultTreeModelTest extends SwingTestCase {
-
     protected DefaultTreeModel model = null;
+
     protected DefaultMutableTreeNode root = null;
 
     class ConcreteTreeModelListener extends FindableListener implements TreeModelListener {
         public TreeModelEvent event = null;
+
         public String type = null;
+
         public boolean fired = false;
+
         private final boolean debugOutput;
 
         ConcreteTreeModelListener() {
@@ -50,6 +52,7 @@
             this.debugOutput = debugOutput;
         }
 
+        @Override
         public void reset() {
             event = null;
             type = null;
@@ -92,8 +95,8 @@
             }
         }
 
-        public void checkEvent(Object source, Object[] path,
-                               int[] childIndices, Object[] children) {
+        public void checkEvent(Object source, Object[] path, int[] childIndices,
+                Object[] children) {
             assertNotNull("event", event);
             assertEquals("source", source, event.getSource());
             assertTrue("path", Arrays.equals(path, event.getPath()));
@@ -102,13 +105,14 @@
         }
     }
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
-
         root = new DefaultMutableTreeNode("root");
         model = new DefaultTreeModel(root);
     }
 
+    @Override
     protected void tearDown() throws Exception {
         super.tearDown();
     }
@@ -118,12 +122,10 @@
      */
     public void testDefaultTreeModelTreeNode() {
         TreeNode node = new DefaultMutableTreeNode(null);
-
         model = new DefaultTreeModel(node);
         assertEquals(node, model.root);
         assertFalse(model.asksAllowsChildren);
         assertNotNull(model.listenerList);
-
         model = new DefaultTreeModel(null);
         assertNull(model.root);
         assertFalse(model.asksAllowsChildren);
@@ -135,12 +137,10 @@
      */
     public void testDefaultTreeModelTreeNodeBoolean() {
         TreeNode node = new DefaultMutableTreeNode(null);
-
         model = new DefaultTreeModel(node, true);
         assertEquals(node, model.root);
         assertTrue(model.asksAllowsChildren);
         assertNotNull(model.listenerList);
-
         model = new DefaultTreeModel(null, false);
         assertNull(model.root);
         assertFalse(model.asksAllowsChildren);
@@ -152,12 +152,9 @@
      */
     public void testSetAsksAllowsChildren() {
         TreeNode node = new DefaultMutableTreeNode(null);
-
         model = new DefaultTreeModel(node);
-
         model.setAsksAllowsChildren(true);
         assertTrue(model.asksAllowsChildren);
-
         model.setAsksAllowsChildren(false);
         assertFalse(model.asksAllowsChildren);
     }
@@ -167,12 +164,9 @@
      */
     public void testSetGetAsksAllowsChildren() {
         TreeNode node = new DefaultMutableTreeNode(null);
-
         model = new DefaultTreeModel(node);
-
         model.asksAllowsChildren = true;
         assertTrue(model.asksAllowsChildren());
-
         model.asksAllowsChildren = false;
         assertFalse(model.asksAllowsChildren());
     }
@@ -184,20 +178,17 @@
         ConcreteTreeModelListener listener1 = new ConcreteTreeModelListener();
         ConcreteTreeModelListener listener2 = new ConcreteTreeModelListener();
         TreeModelListener[] listenersArray = null;
-
         model.addTreeModelListener(listener1);
         listenersArray = model.getTreeModelListeners();
         assertTrue(listenersArray.length == 1);
         assertEquals(1, model.listenerList.getListeners(TreeModelListener.class).length);
         assertEquals(1, model.getListeners(TreeModelListener.class).length);
         assertTrue(listener1.findMe(listenersArray) > 0);
-
         model.addTreeModelListener(listener2);
         listenersArray = model.getTreeModelListeners();
         assertEquals(2, listenersArray.length);
         assertTrue(listener1.findMe(listenersArray) > 0);
         assertTrue(listener2.findMe(listenersArray) > 0);
-
         model.addTreeModelListener(listener2);
         listenersArray = model.getTreeModelListeners();
         assertEquals(3, listenersArray.length);
@@ -211,7 +202,6 @@
         ConcreteTreeModelListener changeListener2 = new ConcreteTreeModelListener();
         ConcreteTreeModelListener changeListener3 = new ConcreteTreeModelListener();
         TreeModelListener[] listenersArray = null;
-
         model.addTreeModelListener(changeListener1);
         model.addTreeModelListener(changeListener2);
         model.addTreeModelListener(changeListener3);
@@ -220,19 +210,16 @@
         assertEquals(1, changeListener1.findMe(listenersArray));
         assertEquals(1, changeListener2.findMe(listenersArray));
         assertEquals(1, changeListener3.findMe(listenersArray));
-
         model.removeTreeModelListener(changeListener2);
         listenersArray = model.getTreeModelListeners();
         assertEquals(2, listenersArray.length);
         assertEquals(1, changeListener1.findMe(listenersArray));
         assertEquals(0, changeListener2.findMe(listenersArray));
         assertEquals(1, changeListener3.findMe(listenersArray));
-
         model.removeTreeModelListener(changeListener1);
         listenersArray = model.getTreeModelListeners();
         assertEquals(1, listenersArray.length);
         assertEquals(1, changeListener3.findMe(listenersArray));
-
         model.removeTreeModelListener(changeListener3);
         listenersArray = model.getTreeModelListeners();
         assertEquals(0, listenersArray.length);
@@ -246,10 +233,8 @@
         ConcreteTreeModelListener changeListener2 = new ConcreteTreeModelListener();
         ConcreteTreeModelListener changeListener3 = new ConcreteTreeModelListener();
         TreeModelListener[] listenersArray = null;
-
         listenersArray = model.getTreeModelListeners();
         assertTrue(listenersArray != null && listenersArray.length == 0);
-
         model.addTreeModelListener(changeListener1);
         model.addTreeModelListener(changeListener2);
         model.addTreeModelListener(changeListener3);
@@ -268,23 +253,17 @@
         TreeModelListener listener1 = new ConcreteTreeModelListener();
         TreeModelListener listener2 = new ConcreteTreeModelListener();
         EventListener[] listenersArray = null;
-
         listenersArray = model.getListeners(TreeModelListener.class);
         assertEquals(0, listenersArray.length);
-
         model.addTreeModelListener(listener1);
         model.addTreeModelListener(listener2);
-
         listenersArray = model.getListeners(PropertyChangeListener.class);
         assertEquals(0, listenersArray.length);
-
         listenersArray = model.getListeners(TreeModelListener.class);
         assertEquals(2, listenersArray.length);
-
         model.removeTreeModelListener(listener1);
         listenersArray = model.getListeners(TreeModelListener.class);
         assertEquals(1, listenersArray.length);
-
         model.addTreeModelListener(listener2);
         listenersArray = model.getListeners(TreeModelListener.class);
         assertEquals(2, listenersArray.length);
@@ -303,7 +282,6 @@
         node1.add(node5);
         node2.add(node3);
         node2.add(node4);
-
         assertEquals(node2, model.getChild(node1, 0));
         assertEquals(node5, model.getChild(node1, 1));
         assertEquals(node3, model.getChild(node2, 0));
@@ -323,7 +301,6 @@
         node1.add(node5);
         node2.add(node3);
         node2.add(node4);
-
         assertEquals(2, model.getChildCount(node1));
         assertEquals(2, model.getChildCount(node2));
         assertEquals(0, model.getChildCount(node3));
@@ -339,7 +316,6 @@
         DefaultMutableTreeNode node2 = new DefaultMutableTreeNode(null);
         DefaultMutableTreeNode node3 = new DefaultMutableTreeNode(null);
         DefaultMutableTreeNode node4 = new DefaultMutableTreeNode(null);
-
         node1.add(node2);
         node1.add(node3);
         node3.add(node4);
@@ -359,31 +335,26 @@
         TreeNode root1 = new DefaultMutableTreeNode(null);
         TreeNode root2 = new DefaultMutableTreeNode(null);
         TreeNode root3 = null;
-
         ConcreteTreeModelListener listener = new ConcreteTreeModelListener(false);
         model.addTreeModelListener(listener);
-
         model.setRoot(root1);
         assertEquals(root1, model.root);
         assertNotNull(listener.event);
         assertEquals("structure", listener.type);
-        listener.checkEvent(model, new Object[] {root1}, null, null);
+        listener.checkEvent(model, new Object[] { root1 }, null, null);
         listener.reset();
-
         model.setRoot(root2);
         assertEquals(root2, model.root);
         assertNotNull(listener.event);
         assertEquals("structure", listener.type);
-        listener.checkEvent(model, new Object[] {root2}, null, null);
+        listener.checkEvent(model, new Object[] { root2 }, null, null);
         listener.reset();
-
         model.setRoot(root2);
         assertEquals(root2, model.root);
         assertNotNull(listener.event);
         assertEquals("structure", listener.type);
-        listener.checkEvent(model, new Object[] {root2}, null, null);
+        listener.checkEvent(model, new Object[] { root2 }, null, null);
         listener.reset();
-
         model.setRoot(root3);
         assertEquals(root3, model.root);
         assertNotNull(listener.event);
@@ -399,13 +370,10 @@
         TreeNode root1 = new DefaultMutableTreeNode(null);
         TreeNode root2 = new DefaultMutableTreeNode(null);
         TreeNode root3 = null;
-
         model.root = root1;
         assertEquals(root1, model.getRoot());
-
         model.root = root2;
         assertEquals(root2, model.getRoot());
-
         model.root = root3;
         assertEquals(root3, model.getRoot());
     }
@@ -417,14 +385,12 @@
         DefaultMutableTreeNode node1 = new DefaultMutableTreeNode(null, true);
         DefaultMutableTreeNode node2 = new DefaultMutableTreeNode(null, false);
         DefaultMutableTreeNode node3 = new DefaultMutableTreeNode(null);
-
         model.setAsksAllowsChildren(true);
         assertFalse(model.isLeaf(node1));
         assertTrue(model.isLeaf(node2));
         model.setAsksAllowsChildren(false);
         assertTrue(model.isLeaf(node1));
         assertTrue(model.isLeaf(node2));
-
         node1.add(node3);
         model.setAsksAllowsChildren(true);
         assertFalse(model.isLeaf(node1));
@@ -445,19 +411,15 @@
         node1.add(node5);
         node2.add(node3);
         node2.add(node4);
-
         model.valueForPathChanged(new TreePath(node1), "11");
         assertEquals("11", node1.getUserObject());
-
-        model.valueForPathChanged(new TreePath(new Object[] {node1, node2}), "22");
+        model.valueForPathChanged(new TreePath(new Object[] { node1, node2 }), "22");
         assertEquals("22", node2.getUserObject());
         assertEquals("11", node1.getUserObject());
-
-        model.valueForPathChanged(new TreePath(new Object[] {node2}), "222");
+        model.valueForPathChanged(new TreePath(new Object[] { node2 }), "222");
         assertEquals("222", node2.getUserObject());
         assertEquals("11", node1.getUserObject());
-
-        model.valueForPathChanged(new TreePath(new Object[] {node2, node4}), "222444");
+        model.valueForPathChanged(new TreePath(new Object[] { node2, node4 }), "222444");
         assertEquals("222", node2.getUserObject());
         assertEquals("222444", node4.getUserObject());
     }
@@ -475,25 +437,18 @@
         node1.add(node5);
         node2.add(node3);
         node2.add(node4);
-
         ConcreteTreeModelListener listener = new ConcreteTreeModelListener();
         model.addTreeModelListener(listener);
-
         model.setRoot(null);
         model.reload();
         assertNotNull(listener.event);
         assertEquals("structure", listener.type);
-        listener.checkEvent(model, null,
-                                 new int[0],
-                                 null);
+        listener.checkEvent(model, null, new int[0], null);
         listener.reset();
-
         model.setRoot(root);
         model.reload();
         assertNotNull(listener.event);
-        listener.checkEvent(model, new Object[] {root},
-                            null,
-                            null);
+        listener.checkEvent(model, new Object[] { root }, null, null);
         listener.reset();
     }
 
@@ -510,42 +465,28 @@
         node1.add(node5);
         node2.add(node3);
         node2.add(node4);
-
         ConcreteTreeModelListener listener = new ConcreteTreeModelListener();
         model.addTreeModelListener(listener);
-
         model.reload(null);
         assertNull(listener.event);
-
         model.setRoot(null);
         model.reload(null);
         assertNotNull(listener.event);
         assertEquals("structure", listener.type);
-        listener.checkEvent(model, null,
-                                 new int[0],
-                                 null);
+        listener.checkEvent(model, null, new int[0], null);
         listener.reset();
-
         model.setRoot(root);
         model.reload(root);
         assertNotNull(listener.event);
-        listener.checkEvent(model, new Object[] {root},
-                            null,
-                            null);
+        listener.checkEvent(model, new Object[] { root }, null, null);
         listener.reset();
-
         model.reload(node2);
         assertNotNull(listener.event);
-        listener.checkEvent(model, new Object[] {root, node2},
-                            null,
-                            null);
+        listener.checkEvent(model, new Object[] { root, node2 }, null, null);
         listener.reset();
-
         model.reload(node4);
         assertNotNull(listener.event);
-        listener.checkEvent(model, new Object[] {root, node2, node4},
-                            null,
-                            null);
+        listener.checkEvent(model, new Object[] { root, node2, node4 }, null, null);
         listener.reset();
     }
 
@@ -556,26 +497,22 @@
         DefaultMutableTreeNode node1 = new DefaultMutableTreeNode("1");
         DefaultMutableTreeNode node2 = new DefaultMutableTreeNode("2");
         DefaultMutableTreeNode node3 = new DefaultMutableTreeNode("3");
-
         ConcreteTreeModelListener listener = new ConcreteTreeModelListener();
         model.addTreeModelListener(listener);
         try {
             model.insertNodeInto(null, node1, 0);
             fail("no exception's been thrown");
-        } catch (IllegalArgumentException e) {}
+        } catch (IllegalArgumentException e) {
+        }
         model.insertNodeInto(node1, node2, 0);
         assertNotNull(listener.event);
-        listener.checkEvent(model, new Object[] {node2},
-                                   new int[] {0},
-                                   new Object[] {node1});
-
+        listener.checkEvent(model, new Object[] { node2 }, new int[] { 0 },
+                new Object[] { node1 });
         assertEquals(node1, node2.getChildAt(0));
         listener.reset();
-
         model.insertNodeInto(node3, node2, 0);
-        listener.checkEvent(model, new Object[] {node2},
-                            new int[] {0},
-                            new Object[] {node3});
+        listener.checkEvent(model, new Object[] { node2 }, new int[] { 0 },
+                new Object[] { node3 });
         assertEquals(node3, node2.getChildAt(0));
         assertEquals(node1, node2.getChildAt(1));
     }
@@ -589,28 +526,23 @@
         DefaultMutableTreeNode node3 = new DefaultMutableTreeNode("3");
         node1.add(node2);
         node1.add(node3);
-
         ConcreteTreeModelListener listener = new ConcreteTreeModelListener();
         model.addTreeModelListener(listener);
         try {
             model.removeNodeFromParent(node1);
             fail("no exception's been thrown");
-        } catch (IllegalArgumentException e) {}
+        } catch (IllegalArgumentException e) {
+        }
         model.removeNodeFromParent(node3);
         assertNotNull(listener.event);
-        listener.checkEvent(model, new Object[] {node1},
-                                   new int[] {1},
-                                   new Object[] {node3});
-
+        listener.checkEvent(model, new Object[] { node1 }, new int[] { 1 },
+                new Object[] { node3 });
         assertEquals(1, node1.getChildCount());
         listener.reset();
-
         model.removeNodeFromParent(node2);
         assertNotNull(listener.event);
-        listener.checkEvent(model, new Object[] {node1},
-                                   new int[] {0},
-                                   new Object[] {node2});
-
+        listener.checkEvent(model, new Object[] { node1 }, new int[] { 0 },
+                new Object[] { node2 });
         assertEquals(0, node1.getChildCount());
         listener.reset();
     }
@@ -628,44 +560,34 @@
         node1.add(node5);
         node2.add(node3);
         node2.add(node4);
-
         ConcreteTreeModelListener listener = new ConcreteTreeModelListener();
         model.addTreeModelListener(listener);
-
         model.nodeChanged(null);
         assertNull(listener.event);
-
         model.nodeChanged(node1);
         assertNull(listener.event);
-
         model.nodeChanged(root);
         assertNotNull(listener.event);
         assertEquals("changed", listener.type);
-        listener.checkEvent(model, new Object[] {root}, null, null);
+        listener.checkEvent(model, new Object[] { root }, null, null);
         listener.reset();
-
         model.nodeChanged(node2);
         assertNotNull(listener.event);
         assertEquals("changed", listener.type);
-        listener.checkEvent(model, new Object[] {node1},
-                                   new int[] {0},
-                                   new Object[] {node2});
+        listener.checkEvent(model, new Object[] { node1 }, new int[] { 0 },
+                new Object[] { node2 });
         listener.reset();
-
         model.nodeChanged(node3);
         assertNotNull(listener.event);
         assertEquals("changed", listener.type);
-        listener.checkEvent(model, new Object[] {node1, node2},
-                                   new int[] {0},
-                                   new Object[] {node3});
+        listener.checkEvent(model, new Object[] { node1, node2 }, new int[] { 0 },
+                new Object[] { node3 });
         listener.reset();
-
         model.nodeChanged(node4);
         assertNotNull(listener.event);
         assertEquals("changed", listener.type);
-        listener.checkEvent(model, new Object[] {node1, node2},
-                                   new int[] {1},
-                                   new Object[] {node4});
+        listener.checkEvent(model, new Object[] { node1, node2 }, new int[] { 1 },
+                new Object[] { node4 });
         listener.reset();
     }
 
@@ -682,34 +604,25 @@
         node1.add(node5);
         node2.add(node3);
         node2.add(node4);
-
         ConcreteTreeModelListener listener = new ConcreteTreeModelListener();
         model.addTreeModelListener(listener);
-
         model.nodesWereInserted(null, null);
         assertNull(listener.event);
-
         model.nodesWereInserted(node1, null);
         assertNull(listener.event);
-
         model.nodesWereInserted(node1, new int[0]);
         assertNull(listener.event);
-
-
-        model.nodesWereInserted(node1, new int[] {1, 0});
+        model.nodesWereInserted(node1, new int[] { 1, 0 });
         assertNotNull(listener.event);
         assertEquals("inserted", listener.type);
-        listener.checkEvent(model, new Object[] {node1},
-                                   new int[] {1, 0},
-                                   new Object[] {node5, node2});
+        listener.checkEvent(model, new Object[] { node1 }, new int[] { 1, 0 }, new Object[] {
+                node5, node2 });
         listener.reset();
-
-        model.nodesWereInserted(node2, new int[] {0, 1});
+        model.nodesWereInserted(node2, new int[] { 0, 1 });
         assertNotNull(listener.event);
         assertEquals("inserted", listener.type);
-        listener.checkEvent(model, new Object[] {node1, node2},
-                                   new int[] {0, 1},
-                                   new Object[] {node3, node4});
+        listener.checkEvent(model, new Object[] { node1, node2 }, new int[] { 0, 1 },
+                new Object[] { node3, node4 });
         listener.reset();
     }
 
@@ -726,30 +639,23 @@
         node1.add(node5);
         node2.add(node3);
         node2.add(node4);
-
         ConcreteTreeModelListener listener = new ConcreteTreeModelListener();
         model.addTreeModelListener(listener);
-
         model.nodesWereRemoved(null, null, null);
         assertNull(listener.event);
-
         model.nodesWereRemoved(node1, null, null);
         assertNull(listener.event);
-
-        model.nodesWereRemoved(node1, new int[] {1, 0}, new Object[] {node3, node4});
+        model.nodesWereRemoved(node1, new int[] { 1, 0 }, new Object[] { node3, node4 });
         assertNotNull(listener.event);
         assertEquals("removed", listener.type);
-        listener.checkEvent(model, new Object[] {node1},
-                                   new int[] {1, 0},
-                                   new Object[] {node3, node4});
+        listener.checkEvent(model, new Object[] { node1 }, new int[] { 1, 0 }, new Object[] {
+                node3, node4 });
         listener.reset();
-
-        model.nodesWereRemoved(node4, new int[] {1}, new Object[] {node3, node5});
+        model.nodesWereRemoved(node4, new int[] { 1 }, new Object[] { node3, node5 });
         assertNotNull(listener.event);
         assertEquals("removed", listener.type);
-        listener.checkEvent(model, new Object[] {node1, node2, node4},
-                                   new int[] {1},
-                                   new Object[] {node3, node5});
+        listener.checkEvent(model, new Object[] { node1, node2, node4 }, new int[] { 1 },
+                new Object[] { node3, node5 });
         listener.reset();
     }
 
@@ -768,58 +674,44 @@
         node2.add(node3);
         node2.add(node4);
         root.add(node6);
-
         ConcreteTreeModelListener listener = new ConcreteTreeModelListener();
         model.addTreeModelListener(listener);
-
         model.nodesChanged(null, null);
         assertNull(listener.event);
-
         model.nodesChanged(node1, null);
         assertNull(listener.event);
-
         model.nodesChanged(root, null);
         assertNotNull(listener.event);
         assertEquals("changed", listener.type);
-        listener.checkEvent(model, new Object[] {root}, null, null);
+        listener.checkEvent(model, new Object[] { root }, null, null);
         listener.reset();
-
-        model.nodesChanged(root, new int[] {0});
+        model.nodesChanged(root, new int[] { 0 });
         assertNotNull(listener.event);
         assertEquals("changed", listener.type);
-        listener.checkEvent(model, new Object[] {root},
-                                   new int[] {0},
-                                   new Object[] {node6});
+        listener.checkEvent(model, new Object[] { root }, new int[] { 0 },
+                new Object[] { node6 });
         listener.reset();
-
         model.nodesChanged(node1, new int[0]);
         assertNull(listener.event);
-
-        model.nodesChanged(null, new int[] {1});
+        model.nodesChanged(null, new int[] { 1 });
         assertNull(listener.event);
-
-        model.nodesChanged(node2, new int[] {1});
+        model.nodesChanged(node2, new int[] { 1 });
         assertNotNull(listener.event);
         assertEquals("changed", listener.type);
-        listener.checkEvent(model, new Object[] {node1, node2},
-                                   new int[] {1},
-                                   new Object[] {node4});
+        listener.checkEvent(model, new Object[] { node1, node2 }, new int[] { 1 },
+                new Object[] { node4 });
         listener.reset();
-
-        model.nodesChanged(node1, new int[] {0});
+        model.nodesChanged(node1, new int[] { 0 });
         assertNotNull(listener.event);
         assertEquals("changed", listener.type);
-        listener.checkEvent(model, new Object[] {node1},
-                                   new int[] {0},
-                                   new Object[] {node2});
+        listener.checkEvent(model, new Object[] { node1 }, new int[] { 0 },
+                new Object[] { node2 });
         listener.reset();
-
-        model.nodesChanged(node1, new int[] {0, 1});
+        model.nodesChanged(node1, new int[] { 0, 1 });
         assertNotNull(listener.event);
         assertEquals("changed", listener.type);
-        listener.checkEvent(model, new Object[] {node1},
-                                   new int[] {0, 1},
-                                   new Object[] {node2, node5});
+        listener.checkEvent(model, new Object[] { node1 }, new int[] { 0, 1 }, new Object[] {
+                node2, node5 });
         listener.reset();
     }
 
@@ -836,38 +728,26 @@
         node1.add(node5);
         node2.add(node3);
         node2.add(node4);
-
         ConcreteTreeModelListener listener = new ConcreteTreeModelListener();
         model.addTreeModelListener(listener);
-
         model.nodeStructureChanged(null);
         assertNull(listener.event);
-
         model.setRoot(null);
         listener.reset();
         model.nodeStructureChanged(null);
         assertNull(listener.event);
-
         model.nodeStructureChanged(node1);
         assertNotNull(listener.event);
         assertEquals("structure", listener.type);
-        listener.checkEvent(model, new Object[] {node1},
-                                 null,
-                                 null);
+        listener.checkEvent(model, new Object[] { node1 }, null, null);
         listener.reset();
-
         model.nodeStructureChanged(node2);
         assertNotNull(listener.event);
-        listener.checkEvent(model, new Object[] {node1, node2},
-                            null,
-                            null);
+        listener.checkEvent(model, new Object[] { node1, node2 }, null, null);
         listener.reset();
-
         model.nodeStructureChanged(node4);
         assertNotNull(listener.event);
-        listener.checkEvent(model, new Object[] {node1, node2, node4},
-                            null,
-                            null);
+        listener.checkEvent(model, new Object[] { node1, node2, node4 }, null, null);
         listener.reset();
     }
 
@@ -882,17 +762,15 @@
         node1.add(node2);
         node2.add(node3);
         node3.add(node4);
-
         if (isHarmony()) {
             assertEquals(0, model.getPathToRoot(null).length);
         } else {
             assertNull(model.getPathToRoot(null));
         }
-
-        assertTrue(Arrays.equals(new TreeNode[] {node1}, model.getPathToRoot(node1)));
-        assertTrue(Arrays.equals(new TreeNode[] {node1, node2}, model.getPathToRoot(node2)));
-        assertTrue(Arrays.equals(new TreeNode[] {node3}, model.getPathToRoot(node3)));
-        assertTrue(Arrays.equals(new TreeNode[] {node3, node4}, model.getPathToRoot(node4)));
+        assertTrue(Arrays.equals(new TreeNode[] { node1 }, model.getPathToRoot(node1)));
+        assertTrue(Arrays.equals(new TreeNode[] { node1, node2 }, model.getPathToRoot(node2)));
+        assertTrue(Arrays.equals(new TreeNode[] { node3 }, model.getPathToRoot(node3)));
+        assertTrue(Arrays.equals(new TreeNode[] { node3, node4 }, model.getPathToRoot(node4)));
     }
 
     /*
@@ -900,10 +778,9 @@
      */
     public void testFireTreeNodesChanged() {
         Object source1 = "source1";
-        Object[] paths1 = new Object[] {"1", "2"};
-        int[] indices1 = new int[] {100, 200};
-        Object[] children1 = new Object[] {"10", "20"};
-
+        Object[] paths1 = new Object[] { "1", "2" };
+        int[] indices1 = new int[] { 100, 200 };
+        Object[] children1 = new Object[] { "10", "20" };
         ConcreteTreeModelListener listener1 = new ConcreteTreeModelListener();
         ConcreteTreeModelListener listener2 = new ConcreteTreeModelListener();
         model.addTreeModelListener(listener1);
@@ -922,10 +799,9 @@
      */
     public void testFireTreeNodesInserted() {
         Object source1 = "source1";
-        Object[] paths1 = new Object[] {"1", "2"};
-        int[] indices1 = new int[] {100, 200};
-        Object[] children1 = new Object[] {"10", "20"};
-
+        Object[] paths1 = new Object[] { "1", "2" };
+        int[] indices1 = new int[] { 100, 200 };
+        Object[] children1 = new Object[] { "10", "20" };
         ConcreteTreeModelListener listener1 = new ConcreteTreeModelListener();
         ConcreteTreeModelListener listener2 = new ConcreteTreeModelListener();
         model.addTreeModelListener(listener1);
@@ -944,10 +820,9 @@
      */
     public void testFireTreeNodesRemoved() {
         Object source1 = "source1";
-        Object[] paths1 = new Object[] {"1", "2"};
-        int[] indices1 = new int[] {100, 200};
-        Object[] children1 = new Object[] {"10", "20"};
-
+        Object[] paths1 = new Object[] { "1", "2" };
+        int[] indices1 = new int[] { 100, 200 };
+        Object[] children1 = new Object[] { "10", "20" };
         ConcreteTreeModelListener listener1 = new ConcreteTreeModelListener();
         ConcreteTreeModelListener listener2 = new ConcreteTreeModelListener();
         model.addTreeModelListener(listener1);
@@ -966,10 +841,9 @@
      */
     public void testFireTreeStructureChanged() {
         Object source1 = "source1";
-        Object[] paths1 = new Object[] {"1", "2"};
-        int[] indices1 = new int[] {100, 200};
-        Object[] children1 = new Object[] {"10", "20"};
-
+        Object[] paths1 = new Object[] { "1", "2" };
+        int[] indices1 = new int[] { 100, 200 };
+        Object[] children1 = new Object[] { "10", "20" };
         ConcreteTreeModelListener listener1 = new ConcreteTreeModelListener();
         ConcreteTreeModelListener listener2 = new ConcreteTreeModelListener();
         model.addTreeModelListener(listener1);
@@ -982,5 +856,4 @@
         listener1.checkEvent(source1, paths1, indices1, children1);
         listener2.checkEvent(source1, paths1, indices1, children1);
     }
-
 }



Mime
View raw message