harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r479418 [17/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/text/AbstractDocument_DefaultDocumentEventTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_DefaultDocumentEventTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_DefaultDocumentEventTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_DefaultDocumentEventTest.java Sun Nov 26 12:15:43 2006
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 /**
  * @author Alexey A. Ivanov
  * @version $Revision$
@@ -24,7 +23,6 @@
 import java.lang.reflect.Field;
 import java.util.HashMap;
 import java.util.Vector;
-
 import javax.swing.BasicSwingTestCase;
 import javax.swing.UIManager;
 import javax.swing.event.DocumentEvent;
@@ -40,60 +38,72 @@
 import javax.swing.undo.CannotRedoException;
 import javax.swing.undo.CannotUndoException;
 import javax.swing.undo.UndoableEdit;
-
 import junit.framework.TestCase;
 
 /**
  * This class tests functions of AbstractDocument.DefaultDocumentEvent.
  *
  */
-public class AbstractDocument_DefaultDocumentEventTest extends TestCase
-    implements DocumentListener, UndoableEditListener {
-
+public class AbstractDocument_DefaultDocumentEventTest extends TestCase implements
+        DocumentListener, UndoableEditListener {
     /**
      * Document object used in tests.
      */
-    AbstractDocument                      doc;
+    AbstractDocument doc;
+
     /**
      * Event for text insert.
      */
     DefaultDocumentEvent insert;
+
     /**
      * Event for text remove.
      */
     DefaultDocumentEvent remove;
+
     /**
      * Event for change in attributes.
      */
     DefaultDocumentEvent change;
+
     /**
      * Undoable event.
      */
     UndoableEditEvent undoEvent;
 
     private static final String UNDO_TEXT_KEY = "AbstractDocument.undoText";
+
     private static final String REDO_TEXT_KEY = "AbstractDocument.redoText";
 
     private String undoName;
+
     private String redoName;
 
     /*
      * @see TestCase#setUp()
      */
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         doc = new PlainDocument() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
             protected void insertUpdate(final DefaultDocumentEvent event,
                     final AttributeSet attrs) {
                 insert = event;
                 assertTrue(insert.isInProgress());
                 super.insertUpdate(event, attrs);
             }
+
+            @Override
             protected void removeUpdate(final DefaultDocumentEvent event) {
                 remove = event;
                 assertTrue(remove.isInProgress());
                 super.removeUpdate(event);
             }
+
+            @Override
             protected void postRemoveUpdate(final DefaultDocumentEvent event) {
                 assertSame(remove, event);
                 super.postRemoveUpdate(event);
@@ -102,10 +112,7 @@
         };
         doc.insertString(0, "01234" + "\u05DC\u05DD\u05DE\u05DF\u05E0", null);
         doc.remove(3, 4);
-
-        change = doc.new DefaultDocumentEvent(0, 10,
-                DocumentEvent.EventType.CHANGE);
-
+        change = doc.new DefaultDocumentEvent(0, 10, DocumentEvent.EventType.CHANGE);
         undoName = UIManager.getString(UNDO_TEXT_KEY);
         redoName = UIManager.getString(REDO_TEXT_KEY);
     }
@@ -117,29 +124,23 @@
     public void testAddEdit01() throws BadLocationException {
         // insert.isInProgress is false, so we can add no more edits
         assertFalse(insert.addEdit(remove));
-
-        DefaultDocumentEvent edit =
-            doc.new DefaultDocumentEvent(0, 10, DocumentEvent.EventType.CHANGE);
-
+        DefaultDocumentEvent edit = doc.new DefaultDocumentEvent(0, 10,
+                DocumentEvent.EventType.CHANGE);
         assertTrue(edit.addEdit(insert));
         assertTrue(edit.addEdit(remove));
-
         assertEquals(2, getEdits(edit).size());
-
         // Stop collecting and make undo
         edit.end();
         edit.undo();
-
         // The document should be in its intial state
         assertEquals("", doc.getText(0, doc.getLength()));
     }
 
-
-    private static HashMap getChanges(final DefaultDocumentEvent event) {
+    private static HashMap<?, ?> getChanges(final DefaultDocumentEvent event) {
         try {
             Field f = event.getClass().getDeclaredField("changes");
             f.setAccessible(true);
-            return (HashMap)(f.get(event));
+            return (HashMap<?, ?>) (f.get(event));
         } catch (IllegalAccessException e) {
             e.printStackTrace();
         } catch (NoSuchFieldException e) {
@@ -154,38 +155,40 @@
     public void testAddEdit02() {
         // Used as parent for Edits
         final class Parent extends BranchElement {
+            private static final long serialVersionUID = 1L;
+
             public Parent() {
                 doc.super(null, null);
             }
         }
-
         // Element edits
         final class Child extends ElementEdit {
+            private static final long serialVersionUID = 1L;
+
             public boolean undone = false;
+
             public boolean redone = false;
 
             public Child(final Element parent) {
                 super(parent, 0, null, null);
             }
 
+            @Override
             public void undo() {
                 undone = true;
             }
 
+            @Override
             public void redo() {
                 redone = true;
             }
         }
-
-        DefaultDocumentEvent edit =
-            doc.new DefaultDocumentEvent(0, 10, EventType.CHANGE);
-
+        DefaultDocumentEvent edit = doc.new DefaultDocumentEvent(0, 10, EventType.CHANGE);
         Parent[] parent = new Parent[15];
-        Child[]  child  = new Child[parent.length];
+        Child[] child = new Child[parent.length];
         for (int i = 0; i < parent.length; i++) {
-            assertTrue("Can't add edit at " + i, edit.addEdit(child[i] =
-                new Child(parent[i] = new Parent())));
-
+            assertTrue("Can't add edit at " + i, edit.addEdit(child[i] = new Child(
+                    parent[i] = new Parent())));
             if (BasicSwingTestCase.isHarmony()) {
                 if (i < 10) {
                     assertNull(getChanges(edit));
@@ -194,16 +197,12 @@
                 }
             }
         }
-        edit.addEdit((UndoableEdit)getEdits(edit).get(0));
-
+        edit.addEdit((UndoableEdit) getEdits(edit).get(0));
         edit.end();
-
         // A new edit shouldn't be added 'cause we have called end()
-        assertFalse(edit.addEdit((UndoableEdit)getEdits(edit).get(1)));
-
+        assertFalse(edit.addEdit((UndoableEdit) getEdits(edit).get(1)));
         edit.undo();
         edit.redo();
-
         // Do the check
         for (int i = 0; i < parent.length; i++) {
             ElementChange change = edit.getChange(parent[i]);
@@ -211,16 +210,15 @@
             assertTrue("Undo didn't get called at " + i, child[i].undone);
             assertTrue("Redo didn't get called at " + i, child[i].redone);
         }
-
         assertEquals(16, getEdits(edit).size());
     }
 
-    private static Vector getEdits(final DefaultDocumentEvent event) {
+    private static Vector<?> getEdits(final DefaultDocumentEvent event) {
         try {
-            Class eventSuperClass = event.getClass().getSuperclass();
+            Class<?> eventSuperClass = event.getClass().getSuperclass();
             Field f = eventSuperClass.getDeclaredField("edits");
             f.setAccessible(true);
-            return (Vector)(f.get(event));
+            return (Vector<?>) (f.get(event));
         } catch (IllegalAccessException e) {
             e.printStackTrace();
         } catch (NoSuchFieldException e) {
@@ -234,9 +232,9 @@
      */
     public void testToString() {
         String ref = "[";
-        Vector edits = getEdits(insert);
+        Vector<?> edits = getEdits(insert);
         for (int i = 0; i < edits.size(); i++) {
-            AbstractUndoableEdit edit = (AbstractUndoableEdit)edits.get(i);
+            AbstractUndoableEdit edit = (AbstractUndoableEdit) edits.get(i);
             if (i != 0) {
                 ref += ", ";
             }
@@ -247,52 +245,50 @@
     }
 
     public void testGetUndoPresentationName() {
-        assertEquals(undoName + " " + insert.getPresentationName(),
-                     insert.getUndoPresentationName());
-        assertEquals(undoName + " " + remove.getPresentationName(),
-                     remove.getUndoPresentationName());
-        assertEquals(undoName + " " + change.getPresentationName(),
-                     change.getUndoPresentationName());
+        assertEquals(undoName + " " + insert.getPresentationName(), insert
+                .getUndoPresentationName());
+        assertEquals(undoName + " " + remove.getPresentationName(), remove
+                .getUndoPresentationName());
+        assertEquals(undoName + " " + change.getPresentationName(), change
+                .getUndoPresentationName());
     }
 
     public void testGetUndoPresentationNameModified() {
         UIManager.put(UNDO_TEXT_KEY, "ODNU");
         try {
-            assertEquals("ODNU "
-                         + UIManager.getString("AbstractDocument.additionText"),
-                         insert.getUndoPresentationName());
+            assertEquals("ODNU " + UIManager.getString("AbstractDocument.additionText"), insert
+                    .getUndoPresentationName());
         } finally {
             UIManager.put(UNDO_TEXT_KEY, undoName);
         }
     }
 
     public void testGetRedoPresentationName() {
-        assertEquals(redoName + " " + insert.getPresentationName(),
-                     insert.getRedoPresentationName());
-        assertEquals(redoName + " " + remove.getPresentationName(),
-                     remove.getRedoPresentationName());
-        assertEquals(redoName + " " + change.getPresentationName(),
-                     change.getRedoPresentationName());
+        assertEquals(redoName + " " + insert.getPresentationName(), insert
+                .getRedoPresentationName());
+        assertEquals(redoName + " " + remove.getPresentationName(), remove
+                .getRedoPresentationName());
+        assertEquals(redoName + " " + change.getPresentationName(), change
+                .getRedoPresentationName());
     }
 
     public void testGetRedoPresentationNameModified() {
         UIManager.put(REDO_TEXT_KEY, "ODER");
         try {
-            assertEquals("ODER "
-                         + UIManager.getString("AbstractDocument.additionText"),
-                         insert.getRedoPresentationName());
+            assertEquals("ODER " + UIManager.getString("AbstractDocument.additionText"), insert
+                    .getRedoPresentationName());
         } finally {
             UIManager.put(REDO_TEXT_KEY, redoName);
         }
     }
 
     public void testGetPresentationName() {
-        assertSame(UIManager.getString("AbstractDocument.additionText"),
-                   insert.getPresentationName());
-        assertSame(UIManager.getString("AbstractDocument.deletionText"),
-                   remove.getPresentationName());
-        assertSame(UIManager.getString("AbstractDocument.styleChangeText"),
-                   change.getPresentationName());
+        assertSame(UIManager.getString("AbstractDocument.additionText"), insert
+                .getPresentationName());
+        assertSame(UIManager.getString("AbstractDocument.deletionText"), remove
+                .getPresentationName());
+        assertSame(UIManager.getString("AbstractDocument.styleChangeText"), change
+                .getPresentationName());
     }
 
     public void testIsSignificant() {
@@ -303,33 +299,41 @@
     public void testUndo01() throws BadLocationException {
         remove.undo();
         insert.undo();
-
         assertEquals("", doc.getText(0, doc.getLength()));
         assertEquals(1, doc.getBidiRootElement().getElementCount());
-
         try {
             insert.undo();
-
             fail("CannotUndoException should be thrown");
-        } catch (CannotUndoException e) { }
+        } catch (CannotUndoException e) {
+        }
     }
 
     public void testUndo02() throws BadLocationException {
         final class UndoPlainDocument extends PlainDocument {
+            private static final long serialVersionUID = 1L;
+
             BranchElement altRoot = new BranchElement(null, null);
+
             boolean undone = false;
+
             boolean redone = false;
+
+            @Override
             protected void insertUpdate(final DefaultDocumentEvent event,
-                                        final AttributeSet attrs) {
+                    final AttributeSet attrs) {
                 insert = event;
                 super.insertUpdate(event, attrs);
-                event.addEdit(new ElementEdit(altRoot, 0,
-                        new Element[0], new Element[0]) {
+                event.addEdit(new ElementEdit(altRoot, 0, new Element[0], new Element[0]) {
+                    private static final long serialVersionUID = 1L;
+
+                    @Override
                     public void undo() {
                         super.undo();
                         assertSame(Thread.currentThread(), getCurrentWriter());
                         undone = true;
                     }
+
+                    @Override
                     public void redo() {
                         super.redo();
                         assertSame(Thread.currentThread(), getCurrentWriter());
@@ -337,23 +341,21 @@
                     }
                 });
             }
-        };
+        }
+        ;
         doc = new UndoPlainDocument();
-
         doc.insertString(0, "test", null);
-        ElementChange change =
-            insert.getChange(((UndoPlainDocument)doc).altRoot);
+        ElementChange change = insert.getChange(((UndoPlainDocument) doc).altRoot);
         assertNotNull(change);
         assertEquals(0, change.getChildrenAdded().length);
         assertEquals(0, change.getChildrenRemoved().length);
-
         // Additional assertions are in one of undo methods()
         insert.undo();
-        assertTrue(((UndoPlainDocument)doc).undone);
-        assertFalse(((UndoPlainDocument)doc).redone);
+        assertTrue(((UndoPlainDocument) doc).undone);
+        assertFalse(((UndoPlainDocument) doc).redone);
         // Additional assertions are in one of redo methods()
         insert.redo();
-        assertTrue(((UndoPlainDocument)doc).redone);
+        assertTrue(((UndoPlainDocument) doc).redone);
     }
 
     public void testUndo03() throws BadLocationException {
@@ -362,17 +364,14 @@
         doc.addUndoableEditListener(this);
         doc.insertString(0, "01234" + "\u05DC\u05DD\u05DE\u05DF\u05E0", null);
         doc.remove(3, 4);
-
         // Save what we've got
         DefaultDocumentEvent insertEvent = insert;
         //Element insertChildrenAdded[] = insert.
         DefaultDocumentEvent removeEvent = remove;
-
         assertSame(undoEvent.getEdit(), remove);
-        insert    = null;
-        remove    = null;
+        insert = null;
+        remove = null;
         undoEvent = null;
-
         // Try to undo
         removeEvent.undo();
         assertNull(remove);
@@ -380,20 +379,17 @@
         assertNull(undoEvent);
         DefaultDocumentEvent undoInsertEvent = insert;
         insert = null;
-
         insertEvent.undo();
         assertNotNull(remove);
         assertNull(insert);
         assertNull(undoEvent);
         DefaultDocumentEvent undoRemoveEvent = remove;
         remove = null;
-
         assertFalse(undoInsertEvent.canUndo());
         assertTrue(undoInsertEvent.canRedo());
         assertSame(insertEvent, undoRemoveEvent);
         assertSame(EventType.INSERT, insertEvent.getType());
         assertSame(EventType.INSERT, undoRemoveEvent.getType());
-
         assertFalse(undoRemoveEvent.canUndo());
         assertTrue(undoRemoveEvent.canRedo());
         assertSame(removeEvent, undoInsertEvent);
@@ -407,28 +403,23 @@
     public void testRedo() throws BadLocationException {
         remove.undo();
         insert.undo();
-
         assertEquals("", doc.getText(0, doc.getLength()));
-
         insert.redo();
         remove.redo();
-
         assertEquals("012\u05DE\u05DF\u05E0", doc.getText(0, doc.getLength()));
         assertEquals(2, doc.getBidiRootElement().getElementCount());
-
         try {
             remove.redo();
-
             fail("CannotRedoException should be thrown");
-        } catch (CannotRedoException e) { }
+        } catch (CannotRedoException e) {
+        }
     }
 
     public void testDefaultDocumentEvent() {
-        DefaultDocumentEvent event =
-            doc.new DefaultDocumentEvent(10, 7, DocumentEvent.EventType.CHANGE);
-
+        DefaultDocumentEvent event = doc.new DefaultDocumentEvent(10, 7,
+                DocumentEvent.EventType.CHANGE);
         assertEquals(10, event.getOffset());
-        assertEquals(7,  event.getLength());
+        assertEquals(7, event.getLength());
         assertSame(DocumentEvent.EventType.CHANGE, event.getType());
     }
 
@@ -437,8 +428,7 @@
      * AbstractDocument_ElementEditTest.
      */
     public void testGetChange() {
-        assertTrue(insert.getChange(doc.getBidiRootElement())
-                   instanceof ElementEdit);
+        assertTrue(insert.getChange(doc.getBidiRootElement()) instanceof ElementEdit);
         assertNull(insert.getChange(doc.getDefaultRootElement()));
     }
 
@@ -467,11 +457,11 @@
     }
 
     public void insertUpdate(final DocumentEvent event) {
-        insert = (DefaultDocumentEvent)event;
+        insert = (DefaultDocumentEvent) event;
     }
 
     public void removeUpdate(final DocumentEvent event) {
-        remove = (DefaultDocumentEvent)event;
+        remove = (DefaultDocumentEvent) event;
     }
 
     public void undoableEditHappened(final UndoableEditEvent event) {

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_ElementEditTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_ElementEditTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_ElementEditTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_ElementEditTest.java Sun Nov 26 12:15:43 2006
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 /**
  * @author Alexey A. Ivanov
  * @version $Revision$
@@ -25,7 +24,6 @@
 import javax.swing.text.AbstractDocument.ElementEdit;
 import javax.swing.undo.CannotRedoException;
 import javax.swing.undo.CannotUndoException;
-
 import junit.framework.TestCase;
 
 /**
@@ -34,37 +32,49 @@
  *
  */
 public class AbstractDocument_ElementEditTest extends TestCase {
+    AbstractDocument doc;
 
-    AbstractDocument     doc;
     DefaultDocumentEvent insert;
+
     DefaultDocumentEvent remove;
-    ElementEdit          insertEdit;
-    ElementEdit          removeEdit;
-    Element              root;
+
+    ElementEdit insertEdit;
+
+    ElementEdit removeEdit;
+
+    Element root;
 
     /*
      * @see TestCase#setUp()
      */
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         doc = new PlainDocument() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
             protected void insertUpdate(final DefaultDocumentEvent event,
-                                        final AttributeSet attrs) {
+                    final AttributeSet attrs) {
                 insert = event;
                 //if (getName() == "testGetChildrenRemoved")
                 //    System.out.println(getName());
                 super.insertUpdate(event, attrs);
-                insertEdit = (ElementEdit)insert.getChange(root);
+                insertEdit = (ElementEdit) insert.getChange(root);
             }
+
+            @Override
             protected void removeUpdate(final DefaultDocumentEvent event) {
                 remove = event;
                 super.removeUpdate(event);
             }
+
+            @Override
             protected void postRemoveUpdate(final DefaultDocumentEvent event) {
                 assertSame(remove, event);
                 assertNull(remove.getChange(root));
                 super.postRemoveUpdate(event);
-                removeEdit = (ElementEdit)remove.getChange(root);
+                removeEdit = (ElementEdit) remove.getChange(root);
             }
         };
         root = doc.getBidiRootElement();
@@ -77,18 +87,16 @@
         assertEquals(2, root.getElementCount());
         assertEquals(2, getBidiLevel(root.getElement(0)));
         assertEquals(1, getBidiLevel(root.getElement(1)));
-
         insertEdit.undo();
         assertEquals(1, root.getElementCount());
         assertEquals(0, getBidiLevel(root.getElement(0)));
         // The text is not affected with these undoes
         assertEquals("012\u05DE\u05DF\u05E0", doc.getText(0, doc.getLength()));
-
         try {
             insertEdit.undo();
-
             fail("CannotUndoException should be thrown");
-        } catch (CannotUndoException e) { }
+        } catch (CannotUndoException e) {
+        }
     }
 
     /**
@@ -96,13 +104,12 @@
      * redoing document structure changes.
      */
     public void testUndo02() throws BadLocationException {
-        Element[] added   = removeEdit.getChildrenAdded();
+        Element[] added = removeEdit.getChildrenAdded();
         Element[] removed = removeEdit.getChildrenRemoved();
         removeEdit.undo();
         // The added and removed children must change their places after undo
         assertSame(added, removeEdit.getChildrenRemoved());
         assertSame(removed, removeEdit.getChildrenAdded());
-
         removeEdit.redo();
         // The children must return to thier places after redo
         assertSame(added, removeEdit.getChildrenAdded());
@@ -112,52 +119,40 @@
     public void testRedo() throws BadLocationException {
         removeEdit.undo();
         insertEdit.undo();
-
         assertEquals(1, root.getElementCount());
         assertEquals(0, getBidiLevel(root.getElement(0)));
         // The text is not affected with these undoes
         assertEquals("012\u05DE\u05DF\u05E0", doc.getText(0, doc.getLength()));
-
         insertEdit.redo();
         assertEquals(2, root.getElementCount());
         assertEquals(2, getBidiLevel(root.getElement(0)));
         assertEquals(1, getBidiLevel(root.getElement(1)));
-
         removeEdit.redo();
         assertEquals(2, root.getElementCount());
         assertEquals(2, getBidiLevel(root.getElement(0)));
         assertEquals(1, getBidiLevel(root.getElement(1)));
-
         try {
             removeEdit.redo();
-
             fail("CannotRedoException should be thrown");
-        } catch (CannotRedoException e) { }
+        } catch (CannotRedoException e) {
+        }
     }
 
     public void testElementEdit() {
-        Element[] inserted = new Element[] {
-                doc.new BranchElement(null, null),
-                doc.new BranchElement(null, null)
-        };
-        Element[] removed = new Element[] {
-                doc.new LeafElement(null, null, 0, 1),
-                doc.new LeafElement(null, null, 1, 2),
-                doc.new LeafElement(null, null, 2, 3),
-        };
-        AbstractDocument.ElementEdit edit =
-            new AbstractDocument.ElementEdit(doc.getBidiRootElement(), 1,
-                                             removed, inserted);
-
+        Element[] inserted = new Element[] { doc.new BranchElement(null, null),
+                doc.new BranchElement(null, null) };
+        Element[] removed = new Element[] { doc.new LeafElement(null, null, 0, 1),
+                doc.new LeafElement(null, null, 1, 2), doc.new LeafElement(null, null, 2, 3), };
+        AbstractDocument.ElementEdit edit = new AbstractDocument.ElementEdit(doc
+                .getBidiRootElement(), 1, removed, inserted);
         assertSame(doc.getBidiRootElement(), edit.getElement());
         assertSame(inserted, edit.getChildrenAdded());
-        assertSame(removed,  edit.getChildrenRemoved());
+        assertSame(removed, edit.getChildrenRemoved());
         assertEquals(1, edit.getIndex());
     }
 
     private static int getBidiLevel(final Element e) {
-        return ((Integer)e.getAttributes()
-                .getAttribute(StyleConstants.BidiLevel)).intValue();
+        return ((Integer) e.getAttributes().getAttribute(StyleConstants.BidiLevel)).intValue();
     }
 
     public void testGetChildrenRemoved() {
@@ -169,7 +164,6 @@
         assertEquals(7, removed[0].getEndOffset());
         assertEquals(0, getBidiLevel(removed[0]));
         //((AbstractElement)removed[0]).dump(System.out, 0);
-
         removed = removeEdit.getChildrenRemoved();
         assertEquals(2, removed.length);
         assertTrue(removed[0].isLeaf());
@@ -196,7 +190,6 @@
         assertEquals(3, added[1].getStartOffset());
         assertEquals(7, added[1].getEndOffset());
         assertEquals(1, getBidiLevel(added[1]));
-
         added = removeEdit.getChildrenAdded();
         assertEquals(2, added.length);
         assertTrue(added[0].isLeaf());
@@ -219,9 +212,8 @@
         assertEquals(0, removeEdit.getIndex());
         doc.insertString(6, "\nab\ncd\ne", null);
         doc.insertString(doc.getLength(), "\nnew line", null);
-        AbstractDocument.ElementEdit e =
-            (AbstractDocument.ElementEdit)insert.getChange(
-                    doc.getDefaultRootElement());
+        AbstractDocument.ElementEdit e = (AbstractDocument.ElementEdit) insert.getChange(doc
+                .getDefaultRootElement());
         // We've inserted 4 paragraphs of text, then indexes of elements
         // representing them are 0 - 3. When we insert a new paragraph, the
         // element representing the latest paragraph is modified. Hence it
@@ -229,7 +221,5 @@
         // during this process.)
         // Thus the index should be 3 since the first element modified is at 3.
         assertEquals(3, e.getIndex());
-
     }
-
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_FilterTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_FilterTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_FilterTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_FilterTest.java Sun Nov 26 12:15:43 2006
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 /**
  * @author Alexey A. Ivanov
  * @version $Revision$
@@ -22,9 +21,7 @@
 package javax.swing.text;
 
 import java.io.Serializable;
-
 import javax.swing.text.AbstractDocumentTest.DisAbstractedDocument;
-
 import junit.framework.TestCase;
 
 /**
@@ -37,11 +34,11 @@
 
     private AbstractDocument doc;
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         doc = new DisAbstractedDocument(new GapContent());
         doc.setDocumentFilter(new Filter());
-
         // Additional filter
         emptyFilter = new EmptyFilter();
     }
@@ -50,23 +47,22 @@
      * DocumentFilter class that is used as a test filter.
      */
     static class Filter extends DocumentFilter implements Serializable {
+        private static final long serialVersionUID = 1L;
 
-        public void insertString(final FilterBypass fb,
-                                 final int offset,
-                                 String str,
-                                 final AttributeSet attrs)
-                throws BadLocationException {
+        @Override
+        public void insertString(final FilterBypass fb, final int offset, String str,
+                final AttributeSet attrs) throws BadLocationException {
             if (str == "234") {
                 str = "12345";
             } else if (str == "ab") {
                 super.insertString(fb, 0, "a", attrs);
-                super.insertString(fb, fb.getDocument().getLength(),
-                                   "b", attrs);
+                super.insertString(fb, fb.getDocument().getLength(), "b", attrs);
                 return;
             }
             super.insertString(fb, offset, str, attrs);
         }
 
+        @Override
         public void remove(final FilterBypass fb, int offset, int len)
                 throws BadLocationException {
             // The document shall contain "a12345b"
@@ -81,11 +77,9 @@
             super.remove(fb, offset, len);
         }
 
-        public void replace(final FilterBypass fb, int offset, int len,
-                            String str,
-                            final AttributeSet attrs)
-            throws BadLocationException {
-
+        @Override
+        public void replace(final FilterBypass fb, int offset, int len, String str,
+                final AttributeSet attrs) throws BadLocationException {
             if (offset == 1 && len == 5) {
                 fb.remove(offset, len);
                 fb.insertString(fb.getDocument().getLength(), str, attrs);
@@ -100,57 +94,49 @@
     }
 
     private static class EmptyFilter extends DocumentFilter {
-        private boolean insertCalled  = false;
+        private boolean insertCalled = false;
 
-        private boolean removeCalled  = false;
+        private boolean removeCalled = false;
 
         private boolean replaceCalled = false;
 
-        public void insertString(final FilterBypass fb,
-                                 final int offset,
-                                 final String str,
-                                 final AttributeSet attrs)
-                throws BadLocationException {
+        @Override
+        public void insertString(final FilterBypass fb, final int offset, final String str,
+                final AttributeSet attrs) throws BadLocationException {
             insertCalled = true;
             super.insertString(fb, offset, str, attrs);
         }
 
-        public void remove(final FilterBypass fb, final int offset,
-                           final int length)
+        @Override
+        public void remove(final FilterBypass fb, final int offset, final int length)
                 throws BadLocationException {
             removeCalled = true;
             super.remove(fb, offset, length);
         }
 
-        public void replace(final FilterBypass fb,
-                            final int offset, final int length,
-                            final String str, final AttributeSet attrs)
-                throws BadLocationException {
+        @Override
+        public void replace(final FilterBypass fb, final int offset, final int length,
+                final String str, final AttributeSet attrs) throws BadLocationException {
             replaceCalled = true;
             super.replace(fb, offset, length, str, attrs);
         }
 
-        public void check(final boolean eInsert,
-                          final boolean eRemove,
-                          final boolean eReplace) {
+        public void check(final boolean eInsert, final boolean eRemove, final boolean eReplace) {
             if (eInsert) {
                 assertTrue("insertString IS NOT called", insertCalled);
             } else {
                 assertFalse("insertString IS called", insertCalled);
             }
-
             if (eRemove) {
                 assertTrue("remove IS NOT called", removeCalled);
             } else {
                 assertFalse("remove IS called", removeCalled);
             }
-
             if (eReplace) {
                 assertTrue("replace IS NOT called", replaceCalled);
             } else {
                 assertFalse("replace IS called", replaceCalled);
             }
-
             // Reset call flags
             reset();
         }
@@ -181,15 +167,12 @@
      */
     public void testInsertString02() throws BadLocationException {
         doc.setDocumentFilter(emptyFilter);
-
         // Null string
         doc.insertString(0, null, null);
         emptyFilter.check(false, false, false);
-
         // Empty string
         doc.insertString(0, "", null);
         emptyFilter.check(false, false, false);
-
         // Invalid offset
         try {
             doc.insertString(10, "text", null);
@@ -204,7 +187,6 @@
     public void testRemove01() throws BadLocationException {
         doc.insertString(0, "a12345b", null);
         assertEquals("a12345b", doc.getText(0, doc.getLength()));
-
         doc.remove(1, 5);
         assertEquals("a15b", doc.getText(0, doc.getLength()));
         doc.remove(0, 1);
@@ -221,18 +203,15 @@
         doc.setDocumentFilter(emptyFilter);
         doc.insertString(0, "text", null);
         emptyFilter.reset();
-
         // Zero-length
         doc.remove(0, 0);
         emptyFilter.check(false, true, false);
-
         // Invalid length
         try {
             doc.remove(0, 10);
         } catch (BadLocationException e) {
         }
         emptyFilter.check(false, true, false);
-
         // Invalid offset
         try {
             doc.remove(10, 3);
@@ -247,7 +226,6 @@
     public void testReplace01() throws BadLocationException {
         doc.insertString(0, "a12345b", null);
         assertEquals("a12345b", doc.getText(0, doc.getLength()));
-
         doc.replace(1, 5, "cdef", null);
         assertEquals("abcdef", doc.getText(0, doc.getLength()));
         doc.replace(1, 3, "test", null);
@@ -263,32 +241,27 @@
         doc.setDocumentFilter(emptyFilter);
         doc.insertString(0, "text", null);
         emptyFilter.reset();
-
         // Zero-length remove
         doc.replace(0, 0, "test", null);
         emptyFilter.check(false, false, true);
-
         // Invalid remove length
         try {
             doc.replace(0, 10, "test", null);
         } catch (BadLocationException e) {
         }
         emptyFilter.check(false, false, true);
-
         // Invalid offset
         try {
             doc.replace(10, 2, "test", null);
         } catch (BadLocationException e) {
         }
         emptyFilter.check(false, false, true);
-
         // Null string
         try {
             doc.replace(0, 2, null, null);
         } catch (BadLocationException e) {
         }
         emptyFilter.check(false, false, true);
-
         // Empty string
         try {
             doc.replace(0, 2, "", null);
@@ -296,5 +269,4 @@
         }
         emptyFilter.check(false, false, true);
     }
-
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_LeafElementTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_LeafElementTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_LeafElementTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_LeafElementTest.java Sun Nov 26 12:15:43 2006
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 /**
  * @author Alexey A. Ivanov
  * @version $Revision$
@@ -31,25 +30,23 @@
  *
  */
 public class AbstractDocument_LeafElementTest extends BasicSwingTestCase {
-
     protected AbstractDocument doc;
-    protected LeafElement      leaf1;
-    protected LeafElement      leaf2;
-    protected AttributeSet[]   as;
 
+    protected LeafElement leaf1;
+
+    protected LeafElement leaf2;
+
+    protected AttributeSet[] as;
+
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
-
         StyleContextTest.sc = StyleContext.getDefaultStyleContext();
-        as = new AttributeSet[] {
-            StyleContextTest.addAttribute(1),
-            StyleContextTest.addAttribute(null, 2, 2),
-            StyleContextTest.addAttribute(null, 5, 2)
-        };
-
+        as = new AttributeSet[] { StyleContextTest.addAttribute(1),
+                StyleContextTest.addAttribute(null, 2, 2),
+                StyleContextTest.addAttribute(null, 5, 2) };
         doc = new DisAbstractedDocument(new GapContent());
         doc.insertString(0, "0123456789", as[0]);
-
         doc.writeLock();
         BranchElement branch = doc.new BranchElement(null, as[1]);
         leaf1 = doc.new LeafElement(null, as[2], 0, 3);
@@ -95,20 +92,16 @@
     public void testGetStartOffset() throws BadLocationException {
         assertEquals(0, leaf1.getStartOffset());
         assertEquals(5, leaf2.getStartOffset());
-
         doc.insertString(2, "insert", as[2]);
-
-        assertEquals(0,  leaf1.getStartOffset());
+        assertEquals(0, leaf1.getStartOffset());
         assertEquals(11, leaf2.getStartOffset());
     }
 
     public void testGetEndOffset() throws BadLocationException {
         assertEquals(3, leaf1.getEndOffset());
         assertEquals(8, leaf2.getEndOffset());
-
         doc.insertString(4, "insert", as[2]);
-
-        assertEquals(3,  leaf1.getEndOffset());
+        assertEquals(3, leaf1.getEndOffset());
         assertEquals(14, leaf2.getEndOffset());
     }
 
@@ -118,31 +111,24 @@
 
     public void testLeafElement() {
         doc.writeLock();
-
-        AbstractDocument.LeafElement leaf = doc.new LeafElement(leaf1, as[2],
-                3, 9);
-
+        AbstractDocument.LeafElement leaf = doc.new LeafElement(leaf1, as[2], 3, 9);
         assertSame(leaf1, leaf.getParent());
         assertSame(leaf1, leaf.getParentElement());
         assertSame(leaf, leaf.getAttributes());
         assertEquals(as[2].getAttributeCount(), leaf.getAttributeCount());
         assertEquals(3, leaf.getStartOffset());
         assertEquals(9, leaf.getEndOffset());
-
-        int[] start    = {-1,  3,  3,  3}; // start offset
-        int[] expStart = {0,  3,  3,  3};  // expectations for start offset
-        int[] end      = {9, -1,  1, 20};  // end offset
-        int[] expEnd   = {9,  0,  1, 20};  // expectations for end offset
-        int[] intEnd   = {9,  3,  3, 20};  // expectations for our end offset
+        int[] start = { -1, 3, 3, 3 }; // start offset
+        int[] expStart = { 0, 3, 3, 3 }; // expectations for start offset
+        int[] end = { 9, -1, 1, 20 }; // end offset
+        int[] expEnd = { 9, 0, 1, 20 }; // expectations for end offset
+        int[] intEnd = { 9, 3, 3, 20 }; // expectations for our end offset
         for (int i = 0; i < start.length; i++) {
             leaf = doc.new LeafElement(null, null, start[i], end[i]);
-            assertEquals("Start (" + i + ")", expStart[i],
-                         leaf.getStartOffset());
-            assertEquals("End (" + i + ")",
-                         BasicSwingTestCase.isHarmony() ? intEnd[i] : expEnd[i],
-                         leaf.getEndOffset());
+            assertEquals("Start (" + i + ")", expStart[i], leaf.getStartOffset());
+            assertEquals("End (" + i + ")", BasicSwingTestCase.isHarmony() ? intEnd[i]
+                    : expEnd[i], leaf.getEndOffset());
         }
-
         doc.writeUnlock();
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_LeafElement_TreeNodeTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_LeafElement_TreeNodeTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_LeafElement_TreeNodeTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_LeafElement_TreeNodeTest.java Sun Nov 26 12:15:43 2006
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 /**
  * @author Alexey A. Ivanov
  * @version $Revision$
@@ -29,9 +28,9 @@
  * TreeNode interface.
  *
  */
-public class AbstractDocument_LeafElement_TreeNodeTest
-    extends AbstractDocument_AbstractElement_TreeNodeTest {
-
+public class AbstractDocument_LeafElement_TreeNodeTest extends
+        AbstractDocument_AbstractElement_TreeNodeTest {
+    @Override
     protected void setUp() throws Exception {
         doc = new DisAbstractedDocument(new GapContent());
         doc.writeLock();

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_ListenerLockTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_ListenerLockTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_ListenerLockTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_ListenerLockTest.java Sun Nov 26 12:15:43 2006
@@ -25,7 +25,6 @@
 import javax.swing.event.UndoableEditEvent;
 import javax.swing.event.UndoableEditListener;
 import javax.swing.text.AbstractDocumentTest.DisAbstractedDocument;
-
 import junit.framework.TestCase;
 
 /**
@@ -33,52 +32,57 @@
  * AbstractDocument blocks if an exception is thrown from a listener code.
  *
  */
-public class AbstractDocument_ListenerLockTest extends TestCase
-    implements DocumentListener, UndoableEditListener {
-
+public class AbstractDocument_ListenerLockTest extends TestCase implements DocumentListener,
+        UndoableEditListener {
     private AbstractDocument doc;
 
     private static class LockTestError extends Error {
+        private static final long serialVersionUID = 1L;
+
         public LockTestError(String string) {
             super(string);
         }
     }
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         doc = new DisAbstractedDocument(new GapContent());
         doc.insertString(0, "test", null);
         doc.addDocumentListener(this);
         doc.addUndoableEditListener(this);
-
         doc.writeLock();
     }
 
     public void testFireInsertUpdate() throws Exception {
         try {
             doc.fireInsertUpdate(null);
-        } catch (LockTestError e) { }
+        } catch (LockTestError e) {
+        }
         unlockAndLock();
     }
 
     public void testFireRemoveUpdate() throws Exception {
         try {
             doc.fireRemoveUpdate(null);
-        } catch (LockTestError e) { }
+        } catch (LockTestError e) {
+        }
         unlockAndLock();
     }
 
     public void testFireChangedUpdate() throws Exception {
         try {
             doc.fireChangedUpdate(null);
-        } catch (LockTestError e) { }
+        } catch (LockTestError e) {
+        }
         unlockAndLock();
     }
 
     public void testFireUndoableEditUpdate() throws Exception {
         try {
             doc.fireUndoableEditUpdate(null);
-        } catch (LockTestError e) { }
+        } catch (LockTestError e) {
+        }
         unlockAndLock();
     }
 
@@ -104,11 +108,9 @@
 
     private void unlockAndLock() throws BadLocationException {
         doc.writeUnlock();
-
         doc.readLock();
         doc.getText(0, doc.getLength());
         doc.readUnlock();
-
         doc.writeLock();
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_ListenerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_ListenerTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_ListenerTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_ListenerTest.java Sun Nov 26 12:15:43 2006
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 /**
  * @author Alexey A. Ivanov
  * @version $Revision$
@@ -22,7 +21,6 @@
 package javax.swing.text;
 
 import java.util.EventListener;
-
 import javax.swing.event.DocumentEvent;
 import javax.swing.event.DocumentListener;
 import javax.swing.event.UndoableEditEvent;
@@ -30,29 +28,31 @@
 import javax.swing.text.AbstractDocumentTest.DisAbstractedDocument;
 import javax.swing.undo.AbstractUndoableEdit;
 import javax.swing.undo.UndoableEdit;
-
 import junit.framework.TestCase;
 
-public class AbstractDocument_ListenerTest extends TestCase
-    implements DocumentListener, UndoableEditListener {
-
+public class AbstractDocument_ListenerTest extends TestCase implements DocumentListener,
+        UndoableEditListener {
     private AbstractDocument doc;
 
-    DocumentEvent     change;
-    DocumentEvent     insert;
-    DocumentEvent     remove;
+    DocumentEvent change;
+
+    DocumentEvent insert;
+
+    DocumentEvent remove;
+
     UndoableEditEvent undo;
 
     /**
      * Initializes fixture for tests.
      */
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         doc = new DisAbstractedDocument(new GapContent());
         change = null;
         insert = null;
         remove = null;
-        undo   = null;
+        undo = null;
     }
 
     /**
@@ -93,25 +93,22 @@
      */
     private void checkCalledEvents(final boolean[] state) {
         if (state[0]) {
-            assertNotNull("change IS null",  change);
+            assertNotNull("change IS null", change);
         } else {
             assertNull("change IS NOT null", change);
         }
-
         if (state[1]) {
-            assertNotNull("insert IS null",  insert);
+            assertNotNull("insert IS null", insert);
         } else {
             assertNull("insert IS NOT null", insert);
         }
-
         if (state[2]) {
-            assertNotNull("remove IS null",  remove);
+            assertNotNull("remove IS null", remove);
         } else {
             assertNull("remove IS NOT null", remove);
         }
-
         if (state[3]) {
-            assertNotNull("undo IS null",  undo);
+            assertNotNull("undo IS null", undo);
         } else {
             assertNull("undo IS NOT null", undo);
         }
@@ -127,22 +124,19 @@
      * @param undo   true if undoableEditHapped is supposed to be called
      */
     private void checkCalledEvents(final boolean change, final boolean insert,
-                                   final boolean remove, final boolean undo) {
-        checkCalledEvents(new boolean[] {change, insert, remove, undo});
+            final boolean remove, final boolean undo) {
+        checkCalledEvents(new boolean[] { change, insert, remove, undo });
     }
 
     public void testAddDocumentListener() throws BadLocationException {
         doc.insertString(0, "text", null);
         checkCalledEvents(false, false, false, false);
-
         doc.addDocumentListener(this);
         doc.insertString(0, "test", null);
         checkCalledEvents(false, true, false, false);
-
         insert = null;
         doc.remove(0, 4);
         checkCalledEvents(false, false, true, false);
-
         remove = null;
         doc.replace(2, 1, "s", null);
         checkCalledEvents(false, true, true, false);
@@ -154,15 +148,12 @@
         doc.insertString(0, "text", null);
         checkCalledEvents(false, true, false, false);
         doc.removeDocumentListener(this);
-
         insert = null;
         doc.insertString(0, "test", null);
         checkCalledEvents(false, false, false, false);
-
         insert = null;
         doc.remove(0, 4);
         checkCalledEvents(false, false, false, false);
-
         remove = null;
         doc.replace(2, 1, "s", null);
         checkCalledEvents(false, false, false, false);
@@ -171,23 +162,23 @@
     static final DocumentListener docListener = new DocumentListener() {
         public void changedUpdate(final DocumentEvent event) {
         }
+
         public void insertUpdate(final DocumentEvent event) {
         }
+
         public void removeUpdate(final DocumentEvent event) {
         }
     };
 
-    static final UndoableEditListener undoListener =
-        new UndoableEditListener() {
-            public void undoableEditHappened(final UndoableEditEvent event) {
-            }
-        };
+    static final UndoableEditListener undoListener = new UndoableEditListener() {
+        public void undoableEditHappened(final UndoableEditEvent event) {
+        }
+    };
 
     public void testGetDocumentListeners() {
         doc.addDocumentListener(this);
         doc.addDocumentListener(docListener);
         doc.addUndoableEditListener(undoListener);
-
         DocumentListener[] listeners = doc.getDocumentListeners();
         assertEquals(2, listeners.length);
     }
@@ -196,11 +187,9 @@
         doc.addDocumentListener(this);
         doc.addDocumentListener(docListener);
         doc.addUndoableEditListener(undoListener);
-
         EventListener[] listeners;
         listeners = doc.getListeners(DocumentListener.class);
         assertEquals(2, listeners.length);
-
         listeners = doc.getListeners(UndoableEditListener.class);
         assertEquals(1, listeners.length);
     }
@@ -209,7 +198,6 @@
         doc.addDocumentListener(this);
         doc.addDocumentListener(docListener);
         doc.addUndoableEditListener(undoListener);
-
         UndoableEditListener[] listeners = doc.getUndoableEditListeners();
         assertEquals(1, listeners.length);
     }
@@ -217,15 +205,12 @@
     public void testAddUndoableEditListener() throws BadLocationException {
         doc.insertString(0, "text", null);
         checkCalledEvents(false, false, false, false);
-
         doc.addUndoableEditListener(this);
         doc.insertString(0, "test", null);
         checkCalledEvents(false, false, false, true);
-
         undo = null;
         doc.remove(0, 4);
         checkCalledEvents(false, false, false, true);
-
         undo = null;
         doc.replace(2, 1, "s", null);
         checkCalledEvents(false, false, false, true);
@@ -236,15 +221,12 @@
         doc.insertString(0, "text", null);
         checkCalledEvents(false, false, false, true);
         doc.removeUndoableEditListener(this);
-
         undo = null;
         doc.insertString(0, "test", null);
         checkCalledEvents(false, false, false, false);
-
         undo = null;
         doc.remove(0, 4);
         checkCalledEvents(false, false, false, false);
-
         undo = null;
         doc.replace(2, 1, "s", null);
         checkCalledEvents(false, false, false, false);
@@ -254,25 +236,26 @@
         public int getLength() {
             return 0;
         }
+
         public int getOffset() {
             return 0;
         }
+
         public EventType getType() {
             return null;
         }
+
         public Document getDocument() {
             return null;
         }
+
         public ElementChange getChange(final Element element) {
             return null;
         }
     };
 
-
     public void testFireUndoableEditUpdate() {
-        UndoableEditEvent undoEvent =
-               new UndoableEditEvent(doc, new AbstractUndoableEdit());
-
+        UndoableEditEvent undoEvent = new UndoableEditEvent(doc, new AbstractUndoableEdit());
         doc.addUndoableEditListener(this);
         doc.fireUndoableEditUpdate(undoEvent);
         checkCalledEvents(false, false, false, true);
@@ -307,29 +290,25 @@
     public void testInsertString01() throws BadLocationException {
         doc.addDocumentListener(this);
         doc.addUndoableEditListener(this);
-
         doc.insertString(0, "", null);
         checkCalledEvents(false, false, false, false);
-
         doc.insertString(0, null, null);
         checkCalledEvents(false, false, false, false);
-
         doc.remove(0, 0);
         checkCalledEvents(false, false, false, false);
     }
 
     private static class NoUndoContent extends GapContent {
+        private static final long serialVersionUID = 1L;
 
-        public UndoableEdit insertString(int offset, String str)
-            throws BadLocationException {
-
+        @Override
+        public UndoableEdit insertString(int offset, String str) throws BadLocationException {
             super.insertString(offset, str);
             return null;
         }
 
-        public UndoableEdit remove(int offset, int length)
-            throws BadLocationException {
-
+        @Override
+        public UndoableEdit remove(int offset, int length) throws BadLocationException {
             super.remove(offset, length);
             return null;
         }
@@ -343,7 +322,6 @@
         doc = new DisAbstractedDocument(new NoUndoContent());
         doc.addDocumentListener(this);
         doc.addUndoableEditListener(this);
-
         doc.insertString(0, "test string\nthe second line", null);
         checkCalledEvents(false, true, false, false);
     }
@@ -356,7 +334,6 @@
         doc = new DisAbstractedDocument(new NoUndoContent());
         doc.addDocumentListener(this);
         doc.addUndoableEditListener(this);
-
         doc.insertString(0, "\u05DC\u05DD", null);
         checkCalledEvents(false, true, false, false);
         assertNotNull(insert.getChange(doc.getBidiRootElement()));
@@ -369,10 +346,8 @@
     public void testRemove01() throws Exception {
         doc = new DisAbstractedDocument(new NoUndoContent());
         doc.insertString(0, "test string\nthe second line", null);
-
         doc.addDocumentListener(this);
         doc.addUndoableEditListener(this);
-
         doc.remove(0, 4);
         checkCalledEvents(false, false, true, false);
     }
@@ -384,10 +359,8 @@
     public void testRemove02() throws Exception {
         doc = new DisAbstractedDocument(new NoUndoContent());
         doc.insertString(0, "\u05DC\u05DD test string", null);
-
         doc.addDocumentListener(this);
         doc.addUndoableEditListener(this);
-
         doc.remove(0, 2);
         checkCalledEvents(false, false, true, false);
         assertNotNull(remove.getChange(doc.getBidiRootElement()));
@@ -399,20 +372,19 @@
      */
     public void testInsertRemove() throws Exception {
         doc = new DisAbstractedDocument(new GapContent() {
-            public UndoableEdit insertString(int where, String str)
-                throws BadLocationException {
+            private static final long serialVersionUID = 1L;
 
+            @Override
+            public UndoableEdit insertString(int where, String str) throws BadLocationException {
                 super.insertString(where, str);
                 return null;
             }
         });
         doc.addDocumentListener(this);
         doc.addUndoableEditListener(this);
-
         doc.insertString(0, "text", null);
         checkCalledEvents(false, true, false, false);
         insert = null;
-
         doc.remove(0, 2);
         checkCalledEvents(false, false, true, true);
     }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_SerializationTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_SerializationTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_SerializationTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_SerializationTest.java Sun Nov 26 12:15:43 2006
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 /**
  * @author Alexey A. Ivanov
  * @version $Revision$
@@ -24,53 +23,46 @@
 import javax.swing.BasicSwingTestCase;
 import javax.swing.SerializableTestCase;
 import javax.swing.text.AbstractDocumentTest.DisAbstractedDocument;
-
 import org.apache.harmony.x.swing.StringConstants;
 
 public class AbstractDocument_SerializationTest extends SerializableTestCase {
-
     private AbstractDocument doc;
 
-    private final String key   = "key";
+    private final String key = "key";
+
     private final String value = "value";
-    private final String text  = "text\n" + AbstractDocument_UpdateTest.RTL;
 
+    private final String text = "text\n" + AbstractDocument_UpdateTest.RTL;
+
+    @Override
     protected void setUp() throws Exception {
         toSave = doc = new DisAbstractedDocument(new GapContent());
         doc.insertString(0, text, null);
         doc.putProperty(key, value);
         doc.setDocumentFilter(new AbstractDocument_FilterTest.Filter());
-
         super.setUp();
     }
 
+    @Override
     public void testSerializable() throws BadLocationException {
-        AbstractDocument restored = (AbstractDocument)toLoad;
-
+        AbstractDocument restored = (AbstractDocument) toLoad;
         assertEquals(text, restored.getText(0, restored.getLength()));
         assertEquals(value, restored.getProperty(key));
-        assertEquals(Boolean.TRUE,
-                     restored.getProperty(BasicSwingTestCase.isHarmony()
-                                          ? StringConstants.BIDI_PROPERTY
-                                          : "i18n"));
-
+        assertEquals(Boolean.TRUE, restored
+                .getProperty(BasicSwingTestCase.isHarmony() ? StringConstants.BIDI_PROPERTY
+                        : "i18n"));
         if (BasicSwingTestCase.isHarmony()) {
-            AbstractDocument_ListenerTest listener =
-                new AbstractDocument_ListenerTest();
+            AbstractDocument_ListenerTest listener = new AbstractDocument_ListenerTest();
             restored.addDocumentListener(listener);
             restored.addUndoableEditListener(listener);
             restored.insertString(0, "234", null);
             // 12345 must be inserted instead of only 234 'cause of filter
-            assertEquals("12345" + text,
-                         restored.getText(0, restored.getLength()));
+            assertEquals("12345" + text, restored.getText(0, restored.getLength()));
             // Event handlers should be called
             assertNotNull(listener.insert);
             assertNotNull(listener.undo);
-
             assertEquals(0, restored.getStartPosition().getOffset());
-            assertEquals(restored.getLength() + 1,
-                         restored.getEndPosition().getOffset());
-
+            assertEquals(restored.getLength() + 1, restored.getEndPosition().getOffset());
             // Test readers are not null
             restored.readLock();
             restored.readUnlock();

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_UpdateTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_UpdateTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_UpdateTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractDocument_UpdateTest.java Sun Nov 26 12:15:43 2006
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 /**
  * @author Alexey A. Ivanov
  * @version $Revision$
@@ -22,64 +21,73 @@
 package javax.swing.text;
 
 import java.awt.font.TextAttribute;
-
 import javax.swing.text.AbstractDocument.DefaultDocumentEvent;
 import javax.swing.text.AbstractDocument.ElementEdit;
-
 import junit.framework.TestCase;
 
 public class AbstractDocument_UpdateTest extends TestCase {
-
     /**
      * Event for last insertString.
      */
     DefaultDocumentEvent insert;
+
     /**
      * Event for last remove.
      */
     DefaultDocumentEvent remove;
+
     /**
      * Element edits for <code>root</code> ocurred when text was inserted.
      */
-    ElementEdit          insertEdit;
+    ElementEdit insertEdit;
+
     /**
      * Element edits for <code>root</code> ocurred when text was removed.
      */
-    ElementEdit          removeEdit;
+    ElementEdit removeEdit;
+
     /**
      * Root element for which element edits are tracked.
      */
-    Element                               root;
+    Element root;
 
     private AbstractDocument doc;
+
     /**
      * String with three characters with right-to-left reading order.
      */
     static final String RTL = "\u05DC\u05DD\u05DE";
+
     /**
      * String with three characters with left-to-right reading order.
      */
     static final String LTR = "abc";
+
     /**
      * String with three digits.
      */
     static final String DIG = "012";
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         doc = new PlainDocument() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
             protected void insertUpdate(final DefaultDocumentEvent event,
-                                        final AttributeSet attrs) {
+                    final AttributeSet attrs) {
                 insert = event;
                 super.insertUpdate(event, attrs);
                 assertTrue(event.isInProgress());
                 // Get edits for root (bidi) element
-                insertEdit = (ElementEdit)insert.getChange(root);
+                insertEdit = (ElementEdit) insert.getChange(root);
             }
 
             /**
              * Overridden to catch first phase of remove update.
              */
+            @Override
             protected void removeUpdate(final DefaultDocumentEvent event) {
                 remove = event;
                 // Assert there's no paragraph changes so far
@@ -89,6 +97,7 @@
                 assertTrue(event.isInProgress());
             }
 
+            @Override
             protected void postRemoveUpdate(final DefaultDocumentEvent event) {
                 // Assert the event passed here is the same passed
                 //     to removeUpdate
@@ -98,7 +107,7 @@
                 super.postRemoveUpdate(event);
                 assertTrue(event.isInProgress());
                 // Get edit for root (bidi) element
-                removeEdit = (ElementEdit)remove.getChange(root);
+                removeEdit = (ElementEdit) remove.getChange(root);
             }
         };
         // Use bidiRoot by default however it may be changed but
@@ -120,15 +129,11 @@
      */
     public void testInsertUpdate01() throws BadLocationException {
         assertNull(doc.getProperty(TextAttribute.RUN_DIRECTION));
-
         assertEquals(1, root.getElementCount());
         assertEquals(0, getBidiLevel(root.getElement(0)));
-
         doc.insertString(0, LTR, null);
-
         assertEquals(1, root.getElementCount());
         assertEquals(0, getBidiLevel(root.getElement(0)));
-
         assertNull(insertEdit);
     }
 
@@ -137,18 +142,13 @@
      */
     public void testInsertUpdate02() throws BadLocationException {
         assertNull(doc.getProperty(TextAttribute.RUN_DIRECTION));
-
         assertEquals(1, root.getElementCount());
         assertEquals(0, getBidiLevel(root.getElement(0)));
-
         doc.insertString(0, RTL, null);
-
         assertEquals(1, root.getElementCount());
         assertEquals(1, getBidiLevel(root.getElement(0)));
-
         assertEquals(1, insertEdit.getChildrenAdded().length);
         assertEquals(1, getBidiLevel(insertEdit.getChildrenAdded()[0]));
-
         assertEquals(1, insertEdit.getChildrenRemoved().length);
         assertEquals(0, getBidiLevel(insertEdit.getChildrenRemoved()[0]));
         assertEquals(0, insertEdit.getIndex());
@@ -159,15 +159,11 @@
      */
     public void testInsertUpdate03() throws BadLocationException {
         assertNull(doc.getProperty(TextAttribute.RUN_DIRECTION));
-
         assertEquals(1, root.getElementCount());
         assertEquals(0, getBidiLevel(root.getElement(0)));
-
         doc.insertString(0, DIG, null);
-
         assertEquals(1, root.getElementCount());
         assertEquals(0, getBidiLevel(root.getElement(0)));
-
         assertNull(insertEdit);
     }
 
@@ -176,18 +172,14 @@
      */
     public void testInsertUpdate04() throws BadLocationException {
         assertNull(doc.getProperty(TextAttribute.RUN_DIRECTION));
-
         assertEquals(1, root.getElementCount());
         assertEquals(0, getBidiLevel(root.getElement(0)));
-
         doc.insertString(0, LTR + RTL, null);
-
         // LTR...RTL...\n (the latter is LTR either)
         assertEquals(3, root.getElementCount());
         assertEquals(0, getBidiLevel(root.getElement(0)));
         assertEquals(1, getBidiLevel(root.getElement(1)));
         assertEquals(0, getBidiLevel(root.getElement(2)));
-
         assertEquals(3, insertEdit.getChildrenAdded().length);
         assertEquals(1, insertEdit.getChildrenRemoved().length);
     }
@@ -197,17 +189,13 @@
      */
     public void testInsertUpdate05() throws BadLocationException {
         assertNull(doc.getProperty(TextAttribute.RUN_DIRECTION));
-
         assertEquals(1, root.getElementCount());
         assertEquals(0, getBidiLevel(root.getElement(0)));
-
         doc.insertString(0, RTL + LTR, null);
-
         assertEquals(3, root.getElementCount());
         assertEquals(1, getBidiLevel(root.getElement(0)));
         assertEquals(2, getBidiLevel(root.getElement(1)));
         assertEquals(1, getBidiLevel(root.getElement(2)));
-
         assertEquals(3, insertEdit.getChildrenAdded().length);
         assertEquals(1, insertEdit.getChildrenRemoved().length);
     }
@@ -217,16 +205,12 @@
      */
     public void testInsertUpdate06() throws BadLocationException {
         assertNull(doc.getProperty(TextAttribute.RUN_DIRECTION));
-
         assertEquals(1, root.getElementCount());
         assertEquals(0, getBidiLevel(root.getElement(0)));
-
         doc.insertString(0, DIG + RTL, null);
-
         assertEquals(2, root.getElementCount());
         assertEquals(2, getBidiLevel(root.getElement(0)));
         assertEquals(1, getBidiLevel(root.getElement(1)));
-
         assertEquals(2, insertEdit.getChildrenAdded().length);
         assertEquals(1, insertEdit.getChildrenRemoved().length);
     }
@@ -236,17 +220,13 @@
      */
     public void testInsertUpdate07() throws BadLocationException {
         assertNull(doc.getProperty(TextAttribute.RUN_DIRECTION));
-
         assertEquals(1, root.getElementCount());
         assertEquals(0, getBidiLevel(root.getElement(0)));
-
         doc.insertString(0, RTL + DIG, null);
-
         assertEquals(3, root.getElementCount());
         assertEquals(1, getBidiLevel(root.getElement(0)));
         assertEquals(2, getBidiLevel(root.getElement(1)));
         assertEquals(1, getBidiLevel(root.getElement(2)));
-
         assertEquals(3, insertEdit.getChildrenAdded().length);
         assertEquals(1, insertEdit.getChildrenRemoved().length);
     }
@@ -258,21 +238,16 @@
      * @param levels expected bidi levels
      * @param bounds expected start and end offsets
      */
-    private static void checkLevelsAndBounds(final Element root,
-                                             final int[] levels,
-                                             final int[] bounds) {
+    private static void checkLevelsAndBounds(final Element root, final int[] levels,
+            final int[] bounds) {
         for (int i = 0; i < levels.length; i++) {
             Element element = root.getElement(i);
             int level = getBidiLevel(element);
             assertEquals("Levels different at " + i, levels[i], level);
-
             int start = element.getStartOffset();
-            int end   = element.getEndOffset();
-
-            assertEquals("Start offset different at " + i,
-                         bounds[i], start);
-            assertEquals("End offset different at " + i,
-                         bounds[i + 1], end);
+            int end = element.getEndOffset();
+            assertEquals("Start offset different at " + i, bounds[i], start);
+            assertEquals("End offset different at " + i, bounds[i + 1], end);
         }
     }
 
@@ -282,31 +257,23 @@
      */
     public void testInsertUpdate08() throws BadLocationException {
         assertNull(doc.getProperty(TextAttribute.RUN_DIRECTION));
-
         assertEquals(1, root.getElementCount());
         assertEquals(0, getBidiLevel(root.getElement(0)));
-
         // Init document with two paragraphs of text
-        doc.insertString(0, LTR + RTL + DIG + "\n" + RTL + DIG + LTR + "\n",
-                         null);
-
+        doc.insertString(0, LTR + RTL + DIG + "\n" + RTL + DIG + LTR + "\n", null);
         // Check the document has the expected structure
         assertEquals(8, root.getElementCount());
-        checkLevelsAndBounds(root,
-                             new int[] {0, 1, 2, 0, 1, 2, 1, 0},
-                             new int[] {0, 3, 6, 9, 10, 13, 19, 20, 21});
+        checkLevelsAndBounds(root, new int[] { 0, 1, 2, 0, 1, 2, 1, 0 }, new int[] { 0, 3, 6,
+                9, 10, 13, 19, 20, 21 });
         assertEquals(8, insertEdit.getChildrenAdded().length);
         assertEquals(1, insertEdit.getChildrenRemoved().length);
         assertEquals(0, insertEdit.getIndex());
-
         // Add some more text at the end of document content
         doc.insertString(doc.getLength(), DIG + RTL, null);
-
         // Check the new document structure
         assertEquals(9, root.getElementCount());
-        checkLevelsAndBounds(root,
-                             new int[] {0, 1, 2, 0, 1, 2, 1, 2, 1},
-                             new int[] {0, 3, 6, 9, 10, 13, 19, 20, 23, 27});
+        checkLevelsAndBounds(root, new int[] { 0, 1, 2, 0, 1, 2, 1, 2, 1 }, new int[] { 0, 3,
+                6, 9, 10, 13, 19, 20, 23, 27 });
         // Elements added "\n" of level 1 [19,20]
         //                DIG  of level 2 [20,23]
         //                RTL  of level 1 [23,27]
@@ -315,7 +282,6 @@
         //                  "\n" of level 0 [20,21]
         assertEquals(2, insertEdit.getChildrenRemoved().length);
         assertEquals(6, insertEdit.getIndex());
-
         // Removed children thorough analysis (taking into account
         // marks were moved when text was inserted)
         Element[] removed = insertEdit.getChildrenRemoved();
@@ -331,13 +297,9 @@
      * LTR+RTL+"\n"+LTR text is inserted while default direction of doc is LTR
      */
     public void testInsertUpdate09() throws BadLocationException {
-        doc.insertString(0, LTR + RTL + "\n"
-                            + LTR, null);
-
+        doc.insertString(0, LTR + RTL + "\n" + LTR, null);
         assertEquals(3, root.getElementCount());
-        checkLevelsAndBounds(root,
-                             new int[] {0, 1, 0},
-                             new int[] {0, 3, 6, 11});
+        checkLevelsAndBounds(root, new int[] { 0, 1, 0 }, new int[] { 0, 3, 6, 11 });
     }
 
     /**
@@ -345,15 +307,11 @@
      * bidirectional algorythm in AbstractDocument.
      */
     public void testInsertUpdate10() throws BadLocationException {
-        doc.putProperty(TextAttribute.RUN_DIRECTION,
-                        TextAttribute.RUN_DIRECTION_RTL);
-
+        doc.putProperty(TextAttribute.RUN_DIRECTION, TextAttribute.RUN_DIRECTION_RTL);
         doc.insertString(0, LTR, null);
-
         assertEquals(2, root.getElementCount());
         assertEquals(2, getBidiLevel(root.getElement(0)));
         assertEquals(1, getBidiLevel(root.getElement(1)));
-
         assertEquals(2, insertEdit.getChildrenAdded().length);
         assertEquals(1, insertEdit.getChildrenRemoved().length);
     }
@@ -363,27 +321,22 @@
      * influence on bidirectional algorythm in AbstractDocument.
      */
     public void testInsertUpdate11() throws BadLocationException {
-        StyleContext context = (StyleContext)doc.getAttributeContext();
-
-        doc.insertString(0, LTR,
-                         context.addAttribute(context.getEmptySet(),
-                                              TextAttribute.RUN_DIRECTION,
-                                              TextAttribute.RUN_DIRECTION_RTL));
-
+        StyleContext context = (StyleContext) doc.getAttributeContext();
+        doc.insertString(0, LTR, context.addAttribute(context.getEmptySet(),
+                TextAttribute.RUN_DIRECTION, TextAttribute.RUN_DIRECTION_RTL));
         assertEquals(1, root.getElementCount());
         assertEquals(0, getBidiLevel(root.getElement(0)));
-
         assertNull(insertEdit);
         /*
-        // The assert section would be like this if document supported
-        // properties for paragraphs
-        assertEquals(2, root.getElementCount());
-        assertEquals(2, getBidiLevel(root.getElement(0)));
-        assertEquals(1, getBidiLevel(root.getElement(1)));
-
-        assertEquals(2, insertEdit.getChildrenAdded().length);
-        assertEquals(1, insertEdit.getChildrenRemoved().length);
-        */
+         // The assert section would be like this if document supported
+         // properties for paragraphs
+         assertEquals(2, root.getElementCount());
+         assertEquals(2, getBidiLevel(root.getElement(0)));
+         assertEquals(1, getBidiLevel(root.getElement(1)));
+
+         assertEquals(2, insertEdit.getChildrenAdded().length);
+         assertEquals(1, insertEdit.getChildrenRemoved().length);
+         */
     }
 
     /**
@@ -392,21 +345,14 @@
      */
     public void testInsertUpdate12() throws BadLocationException {
         doc.insertString(0, "kkk", null);
-
-        doc.putProperty(TextAttribute.RUN_DIRECTION,
-                        TextAttribute.RUN_DIRECTION_RTL);
-
+        doc.putProperty(TextAttribute.RUN_DIRECTION, TextAttribute.RUN_DIRECTION_RTL);
         doc.insertString(1, "rrr", null);
-
         doc.replace(0, 6, "kkk", null);
-
         assertEquals(2, root.getElementCount());
         assertEquals(2, getBidiLevel(root.getElement(0)));
         assertEquals(1, getBidiLevel(root.getElement(1)));
-
         assertEquals(2, insertEdit.getChildrenAdded().length);
         assertEquals(1, insertEdit.getChildrenRemoved().length);
-
     }
 
     /**
@@ -415,10 +361,8 @@
      */
     public void testInsertUpdate13() throws BadLocationException {
         assertEquals(0, doc.getLength());
-
         doc.insertString(0, LTR, null);
         assertEquals(1, root.getElementCount());
-
         doc.insertString(doc.getLength(), RTL, null);
         assertEquals(3, root.getElementCount());
         assertEquals(0, getBidiLevel(root.getElement(0)));
@@ -429,24 +373,19 @@
     public void testRemoveUpdate01() throws BadLocationException {
         doc.insertString(0, LTR, null);
         doc.remove(0, 3);
-
         assertEquals(1, root.getElementCount());
         assertEquals(0, getBidiLevel(root.getElement(0)));
-
         assertNull(removeEdit);
     }
 
     public void testRemoveUpdate02() throws BadLocationException {
         doc.insertString(0, RTL, null);
         doc.remove(0, 3);
-
         assertEquals(1, root.getElementCount());
         assertEquals(0, getBidiLevel(root.getElement(0)));
-
         assertEquals(1, removeEdit.getChildrenAdded().length);
         assertEquals(1, removeEdit.getChildrenRemoved().length);
         assertEquals(0, removeEdit.getIndex());
-
         assertEquals(0, getBidiLevel(removeEdit.getChildrenAdded()[0]));
         assertEquals(1, getBidiLevel(removeEdit.getChildrenRemoved()[0]));
     }
@@ -454,10 +393,8 @@
     public void testRemoveUpdate03() throws BadLocationException {
         doc.insertString(0, DIG, null);
         doc.remove(0, 3);
-
         assertEquals(1, root.getElementCount());
         assertEquals(0, getBidiLevel(root.getElement(0)));
-
         assertNull(removeEdit);
     }
 
@@ -467,20 +404,15 @@
      */
     public void testRemoveUpdate08() throws BadLocationException {
         // Init document with three paragraphs of text
-        doc.insertString(0, LTR + RTL + DIG + "\n"
-                            + RTL + DIG + LTR + "\n" +
-                            DIG + RTL, null);
+        doc.insertString(0, LTR + RTL + DIG + "\n" + RTL + DIG + LTR + "\n" + DIG + RTL, null);
         assertEquals(9, root.getElementCount());
-        checkLevelsAndBounds(root,
-                             new int[] {0, 1, 2, 0, 1, 2, 1, 2, 1},
-                             new int[] {0, 3, 6, 9, 10, 13, 19, 20, 23, 27});
+        checkLevelsAndBounds(root, new int[] { 0, 1, 2, 0, 1, 2, 1, 2, 1 }, new int[] { 0, 3,
+                6, 9, 10, 13, 19, 20, 23, 27 });
         doc.remove(10, 3);
-
         // Check the document has the expected structure
         assertEquals(6, root.getElementCount());
-        checkLevelsAndBounds(root,
-                             new int[] {0, 1, 2, 0, 2, 1},
-                             new int[] {0, 3, 6, 9, 17, 20, 24});
+        checkLevelsAndBounds(root, new int[] { 0, 1, 2, 0, 2, 1 }, new int[] { 0, 3, 6, 9, 17,
+                20, 24 });
         // Elements added: "\n" + DIG + LTR + "\n" of level 0 [9,17]
         assertEquals(1, removeEdit.getChildrenAdded().length);
         // Elements removed: "\n"      of level 0 [ 9,10]
@@ -489,7 +421,6 @@
         //                   "\n"      of level 1 [19,20]
         assertEquals(4, removeEdit.getChildrenRemoved().length);
         assertEquals(3, removeEdit.getIndex());
-
         // Removed children thorough analysis (taking into account
         // marks were moved when text was inserted)
         Element[] removed = removeEdit.getChildrenRemoved();
@@ -500,18 +431,13 @@
     }
 
     public void testRemoveUpdate09() throws BadLocationException {
-        doc.insertString(0, LTR + RTL + DIG + RTL + DIG + LTR + DIG + RTL,
-                         null);
+        doc.insertString(0, LTR + RTL + DIG + RTL + DIG + LTR + DIG + RTL, null);
         assertEquals(8, root.getElementCount());
-        checkLevelsAndBounds(root,
-                             new int[] {0, 1, 2, 1, 2, 0, 1, 0},
-                             new int[] {0, 3, 6, 9, 12, 15, 21, 24, 25});
+        checkLevelsAndBounds(root, new int[] { 0, 1, 2, 1, 2, 0, 1, 0 }, new int[] { 0, 3, 6,
+                9, 12, 15, 21, 24, 25 });
         doc.remove(0, doc.getLength());
-
         assertEquals(1, root.getElementCount());
-        checkLevelsAndBounds(root,
-                             new int[] {0},
-                             new int[] {0, 1});
+        checkLevelsAndBounds(root, new int[] { 0 }, new int[] { 0, 1 });
     }
 
     /**
@@ -524,7 +450,6 @@
         doc.insertString(0, LTR + LTR + RTL + RTL + LTR + LTR, null);
         assertEquals(3, root.getElementCount());
         doc.remove(LTR.length() * 2, RTL.length());
-
         assertEquals(3, root.getElementCount());
         assertNotNull(removeEdit);
         assertEquals(3, removeEdit.getChildrenAdded().length);



Mime
View raw message